- This topic has 3 replies, 4 voices, and was last updated 5 years, 2 months ago by .
Viewing 3 reply threads
Viewing 3 reply threads
- You must be logged in to reply to this topic.
hi,kim
why use TCriticalSection for TkbmMWCustomResolver, but not use TkbmMWLock?
Kim is using TCriticalSection a lot as i can see …
Is TkbmMWLock better ? Kim ?
Hi,
Sorry for the delay in replying… trying my best to keep up with all my chores 😉
TkbmMWLock in its native (kbm) representation is much better than TCriticalSection since it use a high performance multiple reader exclusive writer algorithm with features to track which locks are held by which thread if that is of interest in a debugging situation. With very few threads there will not be much difference.
With large number of writer and reader threads doing many iterations, there will be a significant difference.
However TCriticalSection was the standard back in the days before MREW’s and later the kbmMW lock version of MREW. For that reason there are a few (not many) TCriticalSection instances at places.
The biggest challenge in using mutexes is to minimize its use. Hence delay using the mutex until it is absolutely needed, and release it as soon as possible. Most of kbmMW has been designed with that thought in mind, why the use of TCriticalSection is not really a bottleneck in the places it has been used.
hi,
Thank you for your reply, let me understand.
best regards.