My program , in C++, has a thread that insets data to a buffer, and another thead that reads this data.
when there is no more data to read, I wan to wait till the other thread inserts new data.
I mostly work on linux, but I dont know how to do it in Windows.
the most similar thing that I’ve found is the “WaitForSingleObject” function, but it’s not exactly what I need since I dont want to wail till the thread that inserts data is dead.
can someone please direct me to a place I can read about this more?
thanks!
You can use WaitForSingleObject with timeout. Your thread that inserts data might signal to your reader thread that no more data is available. Here is some good reading on this subject:
http://msdn.microsoft.com/en-us/library/windows/desktop/ms686915%28v=vs.85%29.aspx