You are not logged in.
may be ,we need a MultiReadExclusiveWrite / MultiReadSingleWrite kind of lock in mormot code base.
like Delphi 10.4 TLightweightMREW wrapper or TSpinLock.
or like this repo:https://github.com/BeRo1985/pasmp
Offline
For Linux we already have a pthread_rwlock_wrlock, for windows - SRW locks.
From my experiments there is no real performance benefits from using both of them compared to critical section (mutex) in the real life scenarios (for example for session list in mORMot). For some SPECIFIC use cases it makes sense, for sure, but I can't see where to use it in mORMot.
But using such structures adds additional complexity, because both can't be used inside recursion calls. So personally I vote for simplicity (mutex)
Offline
It could make sense for TSynDictionary for instance.
And making those OS structures re-entrant is not difficult: we just have to maintain a ThreadID of the writelocker, and keep a counter.
Offline