User Mode Sync Library for C ++

Does anyone know of a Windows user-mode thread synchronization library for C ++ (using spin locks / atomic operations)? I only need mutexes (~ critical sections), but variable conditions will be a plus.

+3
source share
3 answers

Thanks for answers. It turns out that justifying my expectations regarding the size of the thread library with the increase was a bad idea and writing my own synchronization code based on InterlockedExchange is dead simple. My spin-lock code achieves performance about 20% better than the critical sections of Win32 (and I mean the real performance of the application, not the synthetic test) :)

+1
source

You have victory 32: http://msdn.microsoft.com/en-us/library/ms682530%28VS.85%29.aspx . You have a full explanation of synchronization using this library here .

+3
source

, win32 ( spincount, ).

Visual Studio 2010 Beta2/Win7 x64 Concurrency Runtime (ConcRT), . , ConcRT ( , ). , , boost:: thread ConcRT, .

Intel Threading Building Blocks, . .

Anthony Williams has an implementation of std :: thread for sale on his website, which includes the Atomics library from C ++ 0x, if you really want to create your own spindle blocks.

In general, if you do not perform very fine-grained synchronization, where you guarantee that there will not be much controversy, I would advise you to be smart using spinlocks, they tend to “spin” and as such consume system resources of the processor ...

-Rick

+2
source

Source: https://habr.com/ru/post/1724117/


All Articles