Newsgroups : Borland : borland.public.delphi.nativeapi.win32 : 2005 Jul : TCriticalSection question
| Subject: | TCriticalSection question |
| Posted by: | "Adrien Reboisson" (adrien-reboissonatastasedotcom@spammers-heaven.com) |
| Date: | 6 Jul 2005 01:46:28 |
If multiple threads try to lock the same TCriticalSection in the following order :
Thread #1 calls MyCriticalSection.Acquire. Call succeeds, since the CS wasn't locked before.
Thread #2 calls MyCriticalSection.Acquire. Thread blocked.
Thread #3 calls MyCriticalSection.Acquire. Thread blocked.
Thread #4 calls MyCriticalSection.Acquire. Thread blocked.
When MyCriticalSection will be released by the first thread, am I able to know which thread will acquire the CS (the first, the second, the third ?). Is the order of the callers respected ? In a perfect world, the thread #2 will be resumed, then the thread #3, then the thread #4... Nevertheless I think I read somewhere that a random order was adopted by the OS, not necessarily the original one.
Could someone give me a hint ?...
Best regards,
A.R.