Is there a way to tell from one thread (say the one which locks a monitor object) if another thread is blocked / waiting on same monitor?
Example scenario -
a "collector" thread reads data from a shared object, while the "updater" thread might be blocked and waiting for the collection to end. I would like the collector to know that when he finishes collecting, a possible data update is pending which yield the collected data might already be invalid.
In my case collecting might be a time consuming operation, and also in the next stage the "collector" thread analyzes the data for some more time, which might be a redundant operation in many cases where the data is invalid.