/*++ Routine Description: This routine is used to determine whether or not the caller is executing code while holding a system synchronization primitive. Such a situation can arise when the OS temporarily calls into user-specified code as part of the DLL load procedure. A caller can benefit from this information by avoiding operations that could potentially lead to deadlocks, e.g., acquiring a process private lock. For example, consider the following case: Thread A runs the THREAD_ATTACH routine for DLL X. This routine is invoked with OS DLL synchronization held. Suppose further that as part of this routine Thread A acquires some lock in DLL X (Lx). Thread B runs some code in DLL X that, while holding Lx, calls the OS library loader to, e.g. GetModuleHandle. As this routine acquires OS DLL synchronization, Thread B will deadlock with Thread A. This is an inherent limitation in the design of the OS loader as it performs such callouts as THREAD_ATTACH while holding loader synchronization. It can be partially ameliorated if Thread A detects that it is running with DLL synchronization held and only try-acquires other locks (such as Lx) that it may wish to take Arguments: SynchronizationHeld - Boolean value which indicates whether or not synchronization is held. Return Value: Boolean status. Error code available via GetLastError (). If the routine is invoked prior to invoking the initialization routine, the returned error code will be ERROR_INVALID_FUNCTION. --*/ BOOL WINAPI AuxUlibIsDLLSynchronizationHeld ( OUT PBOOL SynchronizationHeld );
There are 31,311 total registered users.
[+] expand