mirror of
https://git.openldap.org/openldap/openldap.git
synced 2024-12-21 03:10:25 +08:00
ITS#9181 fix ldap_pvt_thread_mutex_t used before its definition
This commit is contained in:
parent
7ce474050e
commit
d5e133f459
@ -153,12 +153,12 @@ typedef HANDLE ldap_int_thread_cond_t;
|
|||||||
typedef DWORD ldap_int_thread_key_t;
|
typedef DWORD ldap_int_thread_key_t;
|
||||||
|
|
||||||
LDAP_F( int )
|
LDAP_F( int )
|
||||||
ldap_pvt_thread_mutex_init_first LDAP_P(( ldap_pvt_thread_mutex_t *mutex ));
|
ldap_int_mutex_firstcreate LDAP_P(( ldap_int_thread_mutex_t *mutex ));
|
||||||
|
|
||||||
#ifndef LDAP_INT_MUTEX_NULL
|
#ifndef LDAP_INT_MUTEX_NULL
|
||||||
#define LDAP_INT_MUTEX_NULL ((HANDLE)0)
|
#define LDAP_INT_MUTEX_NULL ((HANDLE)0)
|
||||||
#define LDAP_INT_MUTEX_FIRSTCREATE(m) \
|
#define LDAP_INT_MUTEX_FIRSTCREATE(m) \
|
||||||
ldap_pvt_thread_mutex_init_first(&(m))
|
ldap_int_mutex_firstcreate(&(m))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
LDAP_END_DECL
|
LDAP_END_DECL
|
||||||
|
@ -54,6 +54,17 @@ ldap_int_thread_destroy( void )
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
ldap_int_mutex_firstcreate( ldap_int_thread_mutex_t *mutex )
|
||||||
|
{
|
||||||
|
if ( *mutex == NULL ) {
|
||||||
|
HANDLE p = CreateMutex( NULL, 0, NULL );
|
||||||
|
if ( InterlockedCompareExchangePointer((PVOID*)mutex, (PVOID)p, NULL) != NULL)
|
||||||
|
CloseHandle( p );
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
ldap_pvt_thread_create( ldap_pvt_thread_t * thread,
|
ldap_pvt_thread_create( ldap_pvt_thread_t * thread,
|
||||||
int detach,
|
int detach,
|
||||||
@ -161,17 +172,6 @@ ldap_pvt_thread_mutex_init( ldap_pvt_thread_mutex_t *mutex )
|
|||||||
return ( 0 );
|
return ( 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
|
||||||
ldap_pvt_thread_mutex_init_first( ldap_pvt_thread_mutex_t *mutex )
|
|
||||||
{
|
|
||||||
if ( *mutex == NULL ) {
|
|
||||||
HANDLE p = CreateMutex( NULL, 0, NULL );
|
|
||||||
if ( InterlockedCompareExchangePointer((PVOID*)mutex, (PVOID)p, NULL) != NULL)
|
|
||||||
CloseHandle( p );
|
|
||||||
}
|
|
||||||
return ( 0 );
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
int
|
||||||
ldap_pvt_thread_mutex_recursive_init( ldap_pvt_thread_mutex_t *mutex )
|
ldap_pvt_thread_mutex_recursive_init( ldap_pvt_thread_mutex_t *mutex )
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user