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)

Filter by
Sorted by
Tagged with
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 ...
Sᴀᴍ Onᴇᴌᴀ's user avatar
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. ...
AntoineB's user avatar
  • 313
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. ...
rycle's user avatar
  • 145
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 ...
JanDotNet's user avatar
  • 8,538
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 ...
Diederick C. Niehorster's user avatar
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 ...
sfanjoy's user avatar
  • 233
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 ...
BanMe's user avatar
  • 75
3 votes
1 answer
3k views

Python lazy dictionary

Here is a lazy dictionary with test cases. ...
Justin Fay's user avatar
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 ...
Martin York's user avatar
  • 94.3k
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: ...
Pinoniq's user avatar
  • 2,970
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 ...
Diederick C. Niehorster's user avatar
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 ...
arcomber's user avatar
  • 2,449
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 ...
Diederick C. Niehorster's user avatar
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 ...
GorrillaMcD's user avatar
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 ...
Hamza Hajeir's user avatar
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 ...
Nick Udell's user avatar
  • 5,197
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 ...
sfanjoy's user avatar
  • 233
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. ...
Diederick C. Niehorster's user avatar