I have a thread that I want to act as a clock. It read a hardware counter and keeps track of the counts that occur. This clock thread will also have a public method of receiving time durations from other threads to signal those threads when the duration is done.
My problem is the interface between the clock thread and the worker threads. My idea would be to have the worker thread give the clock thread an time duration and address to a function to callback. So when the time duration had elasped then the clock thread calls/invokes the function given to it from the worker thread.
Is there a way to pass this callback from worker thread to the clock thread? Or is there a completely better way to do what I want?
My problem is the interface between the clock thread and the worker threads. My idea would be to have the worker thread give the clock thread an time duration and address to a function to callback. So when the time duration had elasped then the clock thread calls/invokes the function given to it from the worker thread.
Is there a way to pass this callback from worker thread to the clock thread? Or is there a completely better way to do what I want?