T
Tomaz Koritnik
Hi
I want to synchronize two threads. One thread is doing some time-expensive
calculation and when it needs aditional data for calculation, it has to
acquire data from data object. The problem is that methods in data object
must execute in main thread. Because of this, I can't use Lock() or
Monitor.Enter because code would execute inside calculate thread. In Win32
messages where used for this and my question is what would be the equivalent
in .NET?
In Win32 I would do this:
Calc thread would request for data by posting a message to main thread. Main
thread would gather data (while calc thread is waiting) and then send data
back by posting a message to calc thread. Calc thread would then continue
calculation.
How do I do it in .NET?
regards
Tomaz
I want to synchronize two threads. One thread is doing some time-expensive
calculation and when it needs aditional data for calculation, it has to
acquire data from data object. The problem is that methods in data object
must execute in main thread. Because of this, I can't use Lock() or
Monitor.Enter because code would execute inside calculate thread. In Win32
messages where used for this and my question is what would be the equivalent
in .NET?
In Win32 I would do this:
Calc thread would request for data by posting a message to main thread. Main
thread would gather data (while calc thread is waiting) and then send data
back by posting a message to calc thread. Calc thread would then continue
calculation.
How do I do it in .NET?
regards
Tomaz