[fpc-devel] Issue with Critical sections

Sergei Gorelkin sergei_gorelkin at mail.ru
Wed Apr 4 14:59:20 CEST 2007


Wednesday, April 04, 2007, 3:00:55 PM, Vinzent wrote:

>> After
>> searching through RTL code, I discovered that abovementioned
>> functions are named InitCriticalSection and DoneCriticalSection. At
>> the same time, the EnterCriticalSection and LeaveCriticalSection are
>> not renamed, so code using them compiles without errors. Why this
>> inconsistency?

VH> Because one is the RTL abstraction on the different OSes, the other one 
VH> is the direct Windows-API-Call.

But EnterCriticalSection/LeaveCriticalSection also exist in Windows API.
And they are implemented in System unit without changing names. Therefore, to
make my code cross-platform, I have only to remove Windows from uses clause -
then cross-platform versions from System unit will be used. This is
fine.

Contrary, InitlalizeCriticalSection and DeleteCriticalSection are
renamed. This makes me wonder. All four functions belong to a single
logical group and are being affected by whatever cross-platform issues in the
same way. One would expect that either all four
are renamed, or all four left with original names - this is the reason for my question.

-- 
Best regards,
 Sergei





More information about the fpc-devel mailing list