On Wed, May 27, 2009 at 4:24 AM, Nick Coghlan <ncogh...@gmail.com> wrote: > > CriticalSections are first come first served on Windows, just like a > regular mutex.
"Starting with Windows Server 2003 with Service Pack 1 (SP1), threads waiting on a critical section do not acquire the critical section on a first-come, first-serve basis." http://msdn.microsoft.com/en-us/library/ms682530(VS.85).aspx Windows critical sections use events for kernel-level synchronization. The user-mode code basically consists of an interlocked instruction inside the spin loop. When the likelihood of contention is low, a critical section should be a big win because it won't need to switch into the kernel. I suspect that contention will be frequent for the GIL A good description of pre-Vista Windows critical sections can be found here: http://msdn.microsoft.com/en-us/magazine/cc164040.aspx -- Curt Hagenlocher c...@hagenlocher.org _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com