...

/

Thread Safe Deferred Callback

Thread Safe Deferred Callback

Asynchronous programming involves being able to execute functions at a future occurrence of some event. Designing a thread-safe deferred callback class becomes a challenging interview question ​and we will learn about it in this lesson​ .

We'll cover the following...

Thread Safe Deferred Callback

Design and implement a thread-safe class that allows registeration of callback methods that are executed after a user specified time interval in seconds has elapsed.

Solution

Let us try to understand the problem without thinking about concurrency. Let's say our class ...