Date: prev next · Thread: first prev next last
2011 Archives by date, by thread · List index


EnterCriticalSection does not return a value... it is recursive but
the doc does not mention any limit (and since Windows is not open
source, I cannot go and look in the source code to find out what the
limit is)

Well, if you just look at the definition of CRITICAL_SECTION in winbase.h (for MinGW) or definition 
of RTL_CRITICAL_SECTION in WinNT.h (for the Windows SDK) you see LONG RecursionCount, and in the 
Windows API LONG is a 32-bit integer (both in 32- and 64-bit code).

an error _can_ occur, but you cannot test for it, because the function
return void.... ahh Windows :-)

Well, just as we deliberately ignore rare errors in our code here, presumably there is a good 
reason for this, too. (But yeah. more likely just laziness and API stability concerns.)

Anyway, CRITICAL_SECTION contains a HANDLE OwningThread field that presumably can be used to check 
for this. Also, there is another struct with "debugging" information associated with each 
CRITICAL_SECTION, which contains information that can apparently be used for more thorough checking 
of critical section usage in a debugging build of software.

--tml



Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.