88// option. This file may not be copied, modified, or distributed
99// except according to those terms.
1010
11- use libc:: { BOOL , DWORD , c_void, LPVOID } ;
11+ use libc:: { BOOL , DWORD , c_void, LPVOID , c_ulong } ;
1212use libc:: types:: os:: arch:: extra:: BOOLEAN ;
1313
14- pub type LPCRITICAL_SECTION = * mut c_void ;
15- pub type LPCONDITION_VARIABLE = * mut CONDITION_VARIABLE ;
16- pub type LPSRWLOCK = * mut SRWLOCK ;
17-
18- #[ cfg( target_arch = "x86" ) ]
19- pub const CRITICAL_SECTION_SIZE : uint = 24 ;
20- #[ cfg( target_arch = "x86_64" ) ]
21- pub const CRITICAL_SECTION_SIZE : uint = 40 ;
14+ pub type PCONDITION_VARIABLE = * mut CONDITION_VARIABLE ;
15+ pub type PSRWLOCK = * mut SRWLOCK ;
16+ pub type ULONG = c_ulong ;
2217
2318#[ repr( C ) ]
2419pub struct CONDITION_VARIABLE { pub ptr : LPVOID }
@@ -31,28 +26,19 @@ pub const CONDITION_VARIABLE_INIT: CONDITION_VARIABLE = CONDITION_VARIABLE {
3126pub const SRWLOCK_INIT : SRWLOCK = SRWLOCK { ptr : 0 as * mut _ } ;
3227
3328extern "system" {
34- // critical sections
35- pub fn InitializeCriticalSectionAndSpinCount (
36- lpCriticalSection : LPCRITICAL_SECTION ,
37- dwSpinCount : DWORD ) -> BOOL ;
38- pub fn DeleteCriticalSection ( lpCriticalSection : LPCRITICAL_SECTION ) ;
39- pub fn EnterCriticalSection ( lpCriticalSection : LPCRITICAL_SECTION ) ;
40- pub fn LeaveCriticalSection ( lpCriticalSection : LPCRITICAL_SECTION ) ;
41- pub fn TryEnterCriticalSection ( lpCriticalSection : LPCRITICAL_SECTION ) -> BOOL ;
42-
4329 // condition variables
44- pub fn SleepConditionVariableCS ( ConditionVariable : LPCONDITION_VARIABLE ,
45- CriticalSection : LPCRITICAL_SECTION ,
46- dwMilliseconds : DWORD ) -> BOOL ;
47- pub fn WakeConditionVariable ( ConditionVariable : LPCONDITION_VARIABLE ) ;
48- pub fn WakeAllConditionVariable ( ConditionVariable : LPCONDITION_VARIABLE ) ;
30+ pub fn SleepConditionVariableSRW ( ConditionVariable : PCONDITION_VARIABLE ,
31+ SRWLock : PSRWLOCK ,
32+ dwMilliseconds : DWORD ,
33+ Flags : ULONG ) -> BOOL ;
34+ pub fn WakeConditionVariable ( ConditionVariable : PCONDITION_VARIABLE ) ;
35+ pub fn WakeAllConditionVariable ( ConditionVariable : PCONDITION_VARIABLE ) ;
4936
5037 // slim rwlocks
51- pub fn AcquireSRWLockExclusive ( SRWLock : LPSRWLOCK ) ;
52- pub fn AcquireSRWLockShared ( SRWLock : LPSRWLOCK ) ;
53- pub fn ReleaseSRWLockExclusive ( SRWLock : LPSRWLOCK ) ;
54- pub fn ReleaseSRWLockShared ( SRWLock : LPSRWLOCK ) ;
55- pub fn TryAcquireSRWLockExclusive ( SRWLock : LPSRWLOCK ) -> BOOLEAN ;
56- pub fn TryAcquireSRWLockShared ( SRWLock : LPSRWLOCK ) -> BOOLEAN ;
38+ pub fn AcquireSRWLockExclusive ( SRWLock : PSRWLOCK ) ;
39+ pub fn AcquireSRWLockShared ( SRWLock : PSRWLOCK ) ;
40+ pub fn ReleaseSRWLockExclusive ( SRWLock : PSRWLOCK ) ;
41+ pub fn ReleaseSRWLockShared ( SRWLock : PSRWLOCK ) ;
42+ pub fn TryAcquireSRWLockExclusive ( SRWLock : PSRWLOCK ) -> BOOLEAN ;
43+ pub fn TryAcquireSRWLockShared ( SRWLock : PSRWLOCK ) -> BOOLEAN ;
5744}
58-
0 commit comments