I'm writing kind of multithreading observer and i encounter some design issue.
Let's say i have some kind of thread pool with queue of tasks to perform on dataset. Some of them are read data only, others override them.
After a change in data, i want to perform notifyall(), so observers can update() their state.
The threads that perform update() task, i want them to be from a different, second thread pool.
And there is a problem: how to force all update() threads to perform their update operation, before another function from first queue of tasks start to modify the data?
I'm thinking about something like passing lock to another, specific thread.