]> granicus.if.org Git - libevent/commit
Construct Windows locks using InitializeCriticalSectionAndSpinCount
authorNick Mathewson <nickm@torproject.org>
Tue, 16 Feb 2010 00:54:15 +0000 (19:54 -0500)
committerNick Mathewson <nickm@torproject.org>
Thu, 18 Feb 2010 05:27:13 +0000 (00:27 -0500)
commit32c6f1bacdb40f0d1b57aa6e8b2ce4eaf3979d08
tree524e0e3f292f0941ebf67a7742adaea2b3cdb618
parentca46d25b01aaf28b319965ee03b8df7816101767
Construct Windows locks using InitializeCriticalSectionAndSpinCount

Previously we were using InitializeCriticalSection, which creates a
lock that blocks immediately on contention and waits to be
rescheduled.  This is inefficient; it's better to wait for a little
while before telling the US to reschedule us, in case the lock becomes
available again really soon (since most locks mostly do).

Good pthreads implementations do this automatically.  On Windows,
though, we need to call this magic function, and we need to pick the
spin count ourselves.
event_iocp.c
evthread_win32.c