Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#5986 closed defect (fixed)

Bad performance of CPLAcquireMutex() on Windows

Reported by: Even Rouault Owned by: warmerdam
Priority: normal Milestone: 2.0.0
Component: default Version: unspecified
Severity: normal Keywords:


CPLAcquireMutex() in the dfWaitInSeconds > 0.0 case does not perform well if the critical section is already hold by another thread.

This is due to the sleep of 125 ms which can be triggered easily on high contention scenarios. In practice dfWaitInSeconds is almost always set to 1000 to mean "infinite", so in that case we can just call EnterCriticalSection?() that will have lower latency than TryEnterCriticalSection?() + Sleep(). And in other cases reduce the sleep to 10 ms.

Change History (3)

comment:1 Changed 6 years ago by Even Rouault

trunk r29302,29303, branches/2.0 r29304 (post RC0) "CPLAcquireMutex(): improve performance on Windows (#5986)"

comment:2 Changed 6 years ago by Even Rouault

Milestone: 2.0
Resolution: fixed
Status: newclosed

comment:3 Changed 6 years ago by Even Rouault


Milestone renamed

Note: See TracTickets for help on using tickets.