Hello everyone
I ran into a little problem using win32 event api. I have threads that are blocked on an event. When some job is ready to be executed, the event is signaled (using SetEvent). Jobs are placed in a shared queue.
According to Microsoft documentation, one of the waiting threads will wake and the event will be reset (autoreset event). The problem i have is that if no thread is wating because they are all busy, the event will be lost and when they go back waiting, none of them will ever know about the new job.
Is there a way to solve that problem ?
Win32 event and thread API question
A missed event is a common problem when not using a lock acquisition system.
The article "Solving 11 likely problems in your multithreaded code" discusses it about 3/4 of the way through, and includes links to several other articles that provide solutions.
Multithreading is hard to do correctly. There is no tutorial you can use, no block of code you can copy, that will give you solid concurrent code. You need to have a complete mindset of concurrency that is used through the entire code base.
The article "Solving 11 likely problems in your multithreaded code" discusses it about 3/4 of the way through, and includes links to several other articles that provide solutions.
Multithreading is hard to do correctly. There is no tutorial you can use, no block of code you can copy, that will give you solid concurrent code. You need to have a complete mindset of concurrency that is used through the entire code base.
Multithreading is hard to do correctly. There is no tutorial you can use, no block of code you can copy, that will give you solid concurrent code. You need to have a complete mindset of concurrency that is used through the entire code base.
Yes, i realize that and this is what i'm trying to get. Thank you very much for the reference.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement