Skip to content

Commit 6014bff

Browse files
committed
---
yaml --- r: 14378 b: refs/heads/try c: 9f49293 h: refs/heads/master v: v3
1 parent b531ef5 commit 6014bff

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
refs/heads/master: 61b1875c16de39c166b0f4d54bba19f9c6777d1a
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 4a81779abd786ff22d71434c6d9a5917ea4cdfff
5-
refs/heads/try: 159dfd7c3b9ea12a4d83c99c1eaa121f4be605c3
5+
refs/heads/try: 9f492932324aded094042759eeb5824c64aa98e0
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105

branches/try/src/rt/sync/lock_and_signal.cpp

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,18 @@ lock_and_signal::lock_and_signal()
1919
: _holding_thread(INVALID_THREAD)
2020
{
2121
_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
2334
}
2435

2536
#else

0 commit comments

Comments
 (0)