File tree Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Original file line number Diff line number Diff line change 2
2
refs/heads/master: 61b1875c16de39c166b0f4d54bba19f9c6777d1a
3
3
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4
4
refs/heads/snap-stage3: 4a81779abd786ff22d71434c6d9a5917ea4cdfff
5
- refs/heads/try: 159dfd7c3b9ea12a4d83c99c1eaa121f4be605c3
5
+ refs/heads/try: 9f492932324aded094042759eeb5824c64aa98e0
6
6
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
Original file line number Diff line number Diff line change @@ -19,7 +19,18 @@ lock_and_signal::lock_and_signal()
19
19
: _holding_thread(INVALID_THREAD)
20
20
{
21
21
_event = CreateEvent (NULL , FALSE , FALSE , NULL );
22
- InitializeCriticalSection (&_cs);
22
+
23
+ // If a CRITICAL_SECTION is not initialized with a spin count, it will
24
+ // default to 0, even on multi-processor systems. MSDN suggests using
25
+ // 4000. On single-processor systems, the spin count parameter is ignored
26
+ // and the critical section's spin count defaults to 0.
27
+ const DWORD SPIN_COUNT = 4000 ;
28
+ CHECKED (!InitializeCriticalSectionAndSpinCount (&_cs, SPIN_COUNT));
29
+
30
+ // TODO? Consider checking GetProcAddress("InitializeCriticalSectionEx")
31
+ // so Windows >= Vista we can use CRITICAL_SECTION_NO_DEBUG_INFO to avoid
32
+ // allocating CRITICAL_SECTION debug info that is never released. See:
33
+ // http://stackoverflow.com/questions/804848/critical-sections-leaking-memory-on-vista-win2008#889853
23
34
}
24
35
25
36
#else
You can’t perform that action at this time.
0 commit comments