mirror of
https://git.openldap.org/openldap/openldap.git
synced 2024-12-21 03:10:25 +08:00
ITS#8772 Remove type distinction for recursive mutexes
This commit is contained in:
parent
e2d01fe984
commit
7fa5eb4242
@ -44,9 +44,7 @@ LDAP_END_DECL
|
||||
|
||||
LDAP_BEGIN_DECL
|
||||
|
||||
#define LDAP_THREAD_HAVE_NATIVE_RECURSIVE_MUTEX
|
||||
typedef pthread_t ldap_int_thread_t;
|
||||
typedef pthread_mutex_t ldap_int_thread_mutex_recursive_t;
|
||||
typedef pthread_mutex_t ldap_int_thread_mutex_t;
|
||||
typedef pthread_cond_t ldap_int_thread_cond_t;
|
||||
typedef pthread_key_t ldap_int_thread_key_t;
|
||||
@ -93,9 +91,7 @@ LDAP_END_DECL
|
||||
|
||||
LDAP_BEGIN_DECL
|
||||
|
||||
#define LDAP_THREAD_HAVE_NATIVE_RECURSIVE_MUTEX
|
||||
typedef pth_t ldap_int_thread_t;
|
||||
typedef pth_mutex_t ldap_int_thread_mutex_recursive_t;
|
||||
typedef pth_mutex_t ldap_int_thread_mutex_t;
|
||||
typedef pth_cond_t ldap_int_thread_cond_t;
|
||||
typedef pth_key_t ldap_int_thread_key_t;
|
||||
@ -124,9 +120,7 @@ LDAP_END_DECL
|
||||
|
||||
LDAP_BEGIN_DECL
|
||||
|
||||
#define LDAP_THREAD_HAVE_NATIVE_RECURSIVE_MUTEX
|
||||
typedef thread_t ldap_int_thread_t;
|
||||
typedef mutex_t ldap_int_thread_mutex_recursive_t;
|
||||
typedef mutex_t ldap_int_thread_mutex_t;
|
||||
typedef cond_t ldap_int_thread_cond_t;
|
||||
typedef thread_key_t ldap_int_thread_key_t;
|
||||
@ -157,9 +151,7 @@ typedef thread_key_t ldap_int_thread_key_t;
|
||||
|
||||
LDAP_BEGIN_DECL
|
||||
|
||||
#define LDAP_THREAD_HAVE_NATIVE_RECURSIVE_MUTEX
|
||||
typedef unsigned long ldap_int_thread_t;
|
||||
typedef HANDLE ldap_int_thread_mutex_recursive_t;
|
||||
typedef HANDLE ldap_int_thread_mutex_t;
|
||||
typedef HANDLE ldap_int_thread_cond_t;
|
||||
typedef DWORD ldap_int_thread_key_t;
|
||||
@ -186,9 +178,7 @@ LDAP_END_DECL
|
||||
|
||||
LDAP_BEGIN_DECL
|
||||
|
||||
#define LDAP_THREAD_HAVE_NATIVE_RECURSIVE_MUTEX
|
||||
typedef int ldap_int_thread_t;
|
||||
typedef int ldap_int_thread_mutex_recursive_t;
|
||||
typedef int ldap_int_thread_mutex_t;
|
||||
typedef int ldap_int_thread_cond_t;
|
||||
typedef int ldap_int_thread_key_t;
|
||||
|
@ -37,7 +37,6 @@ typedef ldap_int_thread_rdwr_t ldap_pvt_thread_rdwr_t;
|
||||
#define LDAP_PVT_MUTEX_FIRSTCREATE LDAP_INT_MUTEX_FIRSTCREATE
|
||||
#define LDAP_PVT_MUTEX_NULL LDAP_INT_MUTEX_NULL
|
||||
#endif
|
||||
typedef ldap_int_thread_mutex_recursive_t ldap_pvt_thread_mutex_recursive_t;
|
||||
typedef ldap_int_thread_rmutex_t ldap_pvt_thread_rmutex_t;
|
||||
typedef ldap_int_thread_key_t ldap_pvt_thread_key_t;
|
||||
#endif /* !LDAP_PVT_THREAD_H_DONE */
|
||||
@ -118,9 +117,6 @@ ldap_pvt_thread_mutex_recursive_init LDAP_P(( ldap_pvt_thread_mutex_t *mutex ));
|
||||
LDAP_F( int )
|
||||
ldap_pvt_thread_mutex_destroy LDAP_P(( ldap_pvt_thread_mutex_t *mutex ));
|
||||
|
||||
LDAP_F( int )
|
||||
ldap_pvt_thread_mutex_recursive_destroy LDAP_P(( ldap_pvt_thread_mutex_recursive_t *mutex ));
|
||||
|
||||
LDAP_F( int )
|
||||
ldap_pvt_thread_mutex_lock LDAP_P(( ldap_pvt_thread_mutex_t *mutex ));
|
||||
|
||||
@ -130,15 +126,6 @@ ldap_pvt_thread_mutex_trylock LDAP_P(( ldap_pvt_thread_mutex_t *mutex ));
|
||||
LDAP_F( int )
|
||||
ldap_pvt_thread_mutex_unlock LDAP_P(( ldap_pvt_thread_mutex_t *mutex ));
|
||||
|
||||
LDAP_F( int )
|
||||
ldap_pvt_thread_mutex_recursive_lock LDAP_P(( ldap_pvt_thread_mutex_recursive_t *mutex ));
|
||||
|
||||
LDAP_F( int )
|
||||
ldap_pvt_thread_mutex_recursive_trylock LDAP_P(( ldap_pvt_thread_mutex_recursive_t *mutex ));
|
||||
|
||||
LDAP_F( int )
|
||||
ldap_pvt_thread_mutex_recursive_unlock LDAP_P(( ldap_pvt_thread_mutex_recursive_t *mutex ));
|
||||
|
||||
LDAP_F( int )
|
||||
ldap_pvt_thread_rmutex_init LDAP_P(( ldap_pvt_thread_rmutex_t *rmutex ));
|
||||
|
||||
|
@ -161,6 +161,13 @@ ldap_pvt_thread_mutex_init( ldap_pvt_thread_mutex_t *mutex )
|
||||
return ( 0 );
|
||||
}
|
||||
|
||||
int
|
||||
ldap_pvt_thread_mutex_recursive_init( ldap_pvt_thread_mutex_t *mutex )
|
||||
{
|
||||
/* All NT mutexes are recursive */
|
||||
return ldap_pvt_thread_mutex_init( mutex );
|
||||
}
|
||||
|
||||
int
|
||||
ldap_pvt_thread_mutex_destroy( ldap_pvt_thread_mutex_t *mutex )
|
||||
{
|
||||
@ -192,17 +199,6 @@ ldap_pvt_thread_mutex_trylock( ldap_pvt_thread_mutex_t *mp )
|
||||
? -1 : 0;
|
||||
}
|
||||
|
||||
int ldap_pvt_thread_mutex_recursive_init( ldap_pvt_thread_mutex_recursive_t *mutex )
|
||||
LDAP_GCCATTR((alias("ldap_pvt_thread_mutex_init")));
|
||||
int ldap_pvt_thread_mutex_recursive_destroy( ldap_pvt_thread_mutex_recursive_t *mutex )
|
||||
LDAP_GCCATTR((alias("ldap_pvt_thread_mutex_destroy")));
|
||||
int ldap_pvt_thread_mutex_recursive_lock( ldap_pvt_thread_mutex_recursive_t *mutex )
|
||||
LDAP_GCCATTR((alias("ldap_pvt_thread_mutex_lock")));
|
||||
int ldap_pvt_thread_mutex_recursive_trylock( ldap_pvt_thread_mutex_recursive_t *mutex )
|
||||
LDAP_GCCATTR((alias("ldap_pvt_thread_mutex_trylock")));
|
||||
int ldap_pvt_thread_mutex_recursive_unlock( ldap_pvt_thread_mutex_recursive_t *mutex )
|
||||
LDAP_GCCATTR((alias("ldap_pvt_thread_mutex_unlock")));
|
||||
|
||||
ldap_pvt_thread_t
|
||||
ldap_pvt_thread_self( void )
|
||||
{
|
||||
|
@ -325,15 +325,6 @@ ldap_pvt_thread_mutex_recursive_init( ldap_pvt_thread_mutex_t *mutex )
|
||||
return ERRVAL( pthread_mutex_init( mutex, &mutex_attr_recursive ) );
|
||||
}
|
||||
|
||||
int ldap_pvt_thread_mutex_recursive_destroy( ldap_pvt_thread_mutex_recursive_t *mutex )
|
||||
LDAP_GCCATTR((alias("ldap_pvt_thread_mutex_destroy")));
|
||||
int ldap_pvt_thread_mutex_recursive_lock( ldap_pvt_thread_mutex_recursive_t *mutex )
|
||||
LDAP_GCCATTR((alias("ldap_pvt_thread_mutex_lock")));
|
||||
int ldap_pvt_thread_mutex_recursive_trylock( ldap_pvt_thread_mutex_recursive_t *mutex )
|
||||
LDAP_GCCATTR((alias("ldap_pvt_thread_mutex_trylock")));
|
||||
int ldap_pvt_thread_mutex_recursive_unlock( ldap_pvt_thread_mutex_recursive_t *mutex )
|
||||
LDAP_GCCATTR((alias("ldap_pvt_thread_mutex_unlock")));
|
||||
|
||||
ldap_pvt_thread_t ldap_pvt_thread_self( void )
|
||||
{
|
||||
return pthread_self();
|
||||
|
@ -160,17 +160,6 @@ ldap_pvt_thread_mutex_trylock( ldap_pvt_thread_mutex_t *mutex )
|
||||
return( pth_mutex_acquire( mutex, 1, NULL ) ? 0 : errno );
|
||||
}
|
||||
|
||||
int ldap_pvt_thread_mutex_recursive_init( ldap_pvt_thread_mutex_recursive_t *mutex )
|
||||
LDAP_GCCATTR((alias("ldap_pvt_thread_mutex_init")));
|
||||
int ldap_pvt_thread_mutex_recursive_destroy( ldap_pvt_thread_mutex_recursive_t *mutex )
|
||||
LDAP_GCCATTR((alias("ldap_pvt_thread_mutex_destroy")));
|
||||
int ldap_pvt_thread_mutex_recursive_lock( ldap_pvt_thread_mutex_recursive_t *mutex )
|
||||
LDAP_GCCATTR((alias("ldap_pvt_thread_mutex_lock")));
|
||||
int ldap_pvt_thread_mutex_recursive_trylock( ldap_pvt_thread_mutex_recursive_t *mutex )
|
||||
LDAP_GCCATTR((alias("ldap_pvt_thread_mutex_trylock")));
|
||||
int ldap_pvt_thread_mutex_recursive_unlock( ldap_pvt_thread_mutex_recursive_t *mutex )
|
||||
LDAP_GCCATTR((alias("ldap_pvt_thread_mutex_unlock")));
|
||||
|
||||
ldap_pvt_thread_t
|
||||
ldap_pvt_thread_self( void )
|
||||
{
|
||||
|
@ -150,17 +150,6 @@ ldap_pvt_thread_mutex_unlock( ldap_pvt_thread_mutex_t *mutex )
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ldap_pvt_thread_mutex_recursive_init( ldap_pvt_thread_mutex_recursive_t *mutex )
|
||||
LDAP_GCCATTR((alias("ldap_pvt_thread_mutex_init")));
|
||||
int ldap_pvt_thread_mutex_recursive_destroy( ldap_pvt_thread_mutex_recursive_t *mutex )
|
||||
LDAP_GCCATTR((alias("ldap_pvt_thread_mutex_destroy")));
|
||||
int ldap_pvt_thread_mutex_recursive_lock( ldap_pvt_thread_mutex_recursive_t *mutex )
|
||||
LDAP_GCCATTR((alias("ldap_pvt_thread_mutex_lock")));
|
||||
int ldap_pvt_thread_mutex_recursive_trylock( ldap_pvt_thread_mutex_recursive_t *mutex )
|
||||
LDAP_GCCATTR((alias("ldap_pvt_thread_mutex_trylock")));
|
||||
int ldap_pvt_thread_mutex_recursive_unlock( ldap_pvt_thread_mutex_recursive_t *mutex )
|
||||
LDAP_GCCATTR((alias("ldap_pvt_thread_mutex_unlock")));
|
||||
|
||||
/*
|
||||
* NO_THREADS requires a separate tpool implementation since
|
||||
* generic ldap_pvt_thread_pool_wrapper loops forever.
|
||||
|
@ -154,20 +154,11 @@ ldap_pvt_thread_mutex_trylock( ldap_pvt_thread_mutex_t *mp )
|
||||
}
|
||||
|
||||
int
|
||||
ldap_pvt_thread_mutex_recursive_init( ldap_pvt_thread_mutex_recursive_t *mutex )
|
||||
ldap_pvt_thread_mutex_recursive_init( ldap_pvt_thread_mutex_t *mutex )
|
||||
{
|
||||
return( mutex_init( mutex, USYNC_THREAD | LOCK_RECURSIVE, NULL ) );
|
||||
}
|
||||
|
||||
int ldap_pvt_thread_mutex_recursive_destroy( ldap_pvt_thread_mutex_recursive_t *mutex )
|
||||
LDAP_GCCATTR((alias("ldap_pvt_thread_mutex_destroy")));
|
||||
int ldap_pvt_thread_mutex_recursive_lock( ldap_pvt_thread_mutex_recursive_t *mutex )
|
||||
LDAP_GCCATTR((alias("ldap_pvt_thread_mutex_lock")));
|
||||
int ldap_pvt_thread_mutex_recursive_trylock( ldap_pvt_thread_mutex_recursive_t *mutex )
|
||||
LDAP_GCCATTR((alias("ldap_pvt_thread_mutex_trylock")));
|
||||
int ldap_pvt_thread_mutex_recursive_unlock( ldap_pvt_thread_mutex_recursive_t *mutex )
|
||||
LDAP_GCCATTR((alias("ldap_pvt_thread_mutex_unlock")));
|
||||
|
||||
ldap_pvt_thread_t
|
||||
ldap_pvt_thread_self( void )
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user