Stkyrdknmblz wrote:
Hello everyone,
In POSIX, it seems there is an option to suspend a thread until some condition is met.
If you mean condition variables, you are misunderstanding what they are, I think.
Quote:
I designed a similar mechanism which allows for entire logical expressions to be evaluated rather than just one conditional variable.
A POSIX condition variable is just a synchronisation device. It does not reflect the actual condition itself. You can already tie "entire logical expressions" to condition variables in POSIX; an application does this by signalling the condition variable when it detects (by whatever means) that the logical expression has become true.
Quote:
Furthermore, it can be used to both suspend the thread if the thread is active/running and resume the thread if it is stopped.
POSIX condition variables achieve both these goals. A thread suspends on the condition variable after checking the condition, determining that it is false, and deciding to wait until another thread makes it true. When another thread makes the condition true, it signals the condition variable and the waiting thread then resumes.
It sound like you plan to make this suspension/resumption
automatic, rather than requiring explicit action by the application. As well as being difficult to implement (assuming it as general as you make it sound), I think this would be less useful since it makes it much more difficult to understand when the thread might become blocked. Also, you need some way of assigning which thread(s) should be blocked when the condition is false. That is normally explicit since a thread itself chooses to wait.