Questions tagged [callback]
Callback is facility to save a piece of code so that it may be invoked later in the current environment (Typically in response to an event)
18
questions
5
votes
2
answers
157
views
Event emitter npm module
I was asked to complete the task described below:
Event Emitters are objects that serve as the core building block in event-driven architectures. They simplify the process of handling asynchronous
...
21
votes
2
answers
15k
views
C++ Observer design pattern implementation
I'm using the Observer design pattern in order to manage events in the game I'm currently developing.
I based myself on the implementation demonstrated here but improved it in order to ease its use.
...
7
votes
1
answer
501
views
Prime Numbers Store
Let's say we need to create a store for selling prime numbers.
Users enter the store and ask to buy a number.
If the number asked is a prime number,
1.1. then it's either available for sale
1.2. ...
6
votes
1
answer
214
views
Processing input in background while user is typing
Use case
A GUI with 2 controls:
An input control for text (a DNA sequence) that should be analyzed
A result control that displays the analyzing result of the entered text
The analysis takes 2-3 ...
6
votes
2
answers
403
views
c++ multithreaded message broadcaster with link lifetime management v3
note: This is v3 of code that was previously reviewed.
I have written a class that handles listeners registering callbacks to receive messages. Link lifetime is managed (or is it? See below). Code is ...
6
votes
1
answer
150
views
C# asynchronous notification vector
The purpose of this class is to efficiently notify another thread when data is available with minimal blocking to access/pass the data. The data reader/producer thread processes data in bulk which ...
4
votes
1
answer
147
views
Constraining a property setter fluently
The below code is aimed at providing you the most amount of control and flexibility with control which value gets set to a property.
I Introduce to you, the ...
3
votes
1
answer
3k
views
Python lazy dictionary
Here is a lazy dictionary with test cases.
...
3
votes
0
answers
58
views
Nisse Server: Part 5 Handler
Getting close to a release of generic server.
Nisse Server: Part 1 Helper Functions
Nisse Server: Part 2 Socket Layer
Nisse Server: Part 3 Stream Layer
Nisse Server: Part 4 Server
As I mentioned ...
2
votes
1
answer
126
views
Observable storage - revised
Previous question:
JavascriptObservable Storage
The idea is to have some storage interface that exists of different buckets - known as Eagles:
...
2
votes
1
answer
4k
views
C++ callback multithreaded, can unregister itself
update: a new version of this code is posted here
With this post, i would like to 1) ask for feedback on below code as it stands:
do i apply all best practices for c++20?
is it safe?
is my way to ...
2
votes
1
answer
1k
views
TCP client library using Winsock WSAEventSelect in C++
One way to write a client which uses a specific protocol, eg http like in this case, is to create a base class with the basic socket handling functionality with virtual functions which can be ...
1
vote
1
answer
59
views
c++ multithreaded message broadcaster with link lifetime management
note: A version of this code without link lifetime management was previously reviewed. Adding lifetime management actually made the code simpler, and the class simpler to use.
I have written a class ...
1
vote
1
answer
543
views
Update subscription
First, some background. I have a Payment model that has_many :subscriptions. When a user pays (creates a new payment), I have an ...
1
vote
1
answer
86
views
C++ Structural Requests System with Payload Management
First things first, I'd thank Mr. G. Sliepen and Mr. Davislor regarding their help in the previous questions (C++ System data transfer design) (C++ System data transfer design - Following 1), given ...
1
vote
1
answer
478
views
Concurrent Task Waiter
I have some code designed to simplify managing multiple asynchronous operations. The code creates callback actions that, when executed by the asynchronous operation, track which asynchronous methods ...
1
vote
0
answers
71
views
C# asynchronous notification vector v2
As a result of my previous post, I have implemented / refactored my code and have started making successful use of my class. However I have come across a couple of new questions:
The observer must ...
1
vote
1
answer
862
views
c++ multithreaded message broadcaster using callbacks
note: This is an updated design after a previous review round.
I have written a class that handles listeners registering callbacks to receive messages. Registered callbacks can be replaced or removed. ...