Indy 9 | Content | Index | Reference

IndyInterlockedDecrement
See Also, Unit: IdGlobal
Provides shared access to a variable in a multi-threaded application.

    function IndyInterlockedDecrement(var I: Integer): Integer;

Unit
IdGlobal
Parameters
var I: Integer
The integer variable to decrement.
Return Value
Integer - Value for the shared variable after decreasing by 1.
Description
IndyInterlockedDecrement is an Integer function that provides a platform-independent mechanism for synchronizied access to the value specifed in I that is shared by multiple threads. IndyInterlockedDecrement prevents more than one thread from using the same variable simultaneously.

IndyInterlockedDecrement is available in Delphi, C++ Builder, and Kylix, and provides WIN32 API compatibliity for the LOCK instruction that was not available on Windows 95.

Note: InterlockedCompareExchange, InterlockedExchange, InterlockedExchangeAdd, InterlockedIncrement, and IndyInterlockedDecrement are written in Assembly language, which is not normally allowed in Indy. However, these routines can only be done in assembly because of the LOCK instruction. Both the Linux and the Windows API support these routines, but they were not supported under Windows 95. The Indy implementation is needed to provide support on that platform.

Created with Doc-O-Matic 2 donated to Project JEDI. Commercial license available from the Doc-O-Matic site.