* thread.h: Revert patch from 2005-09-05.
* thread.cc (pthread_mutex::can_be_unlocked): Return true also if mutex is owned by MUTEX_OWNER_ANONYMOUS.
This commit is contained in:
parent
5843726e51
commit
75833f08cd
@ -1,3 +1,9 @@
|
|||||||
|
2005-09-06 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
|
* thread.h: Revert patch from 2005-09-05.
|
||||||
|
* thread.cc (pthread_mutex::can_be_unlocked): Return true also if
|
||||||
|
mutex is owned by MUTEX_OWNER_ANONYMOUS.
|
||||||
|
|
||||||
2005-09-05 Christopher Faylor <cgf@timesys.com>
|
2005-09-05 Christopher Faylor <cgf@timesys.com>
|
||||||
|
|
||||||
* cygheap.cc (cygheap_init): Eliminate debugging #if.
|
* cygheap.cc (cygheap_init): Eliminate debugging #if.
|
||||||
|
@ -212,10 +212,11 @@ pthread_mutex::can_be_unlocked (pthread_mutex_t const *mutex)
|
|||||||
|
|
||||||
if (!is_good_object (mutex))
|
if (!is_good_object (mutex))
|
||||||
return false;
|
return false;
|
||||||
/*
|
/* Check if the mutex is owned by the current thread and can be unlocked.
|
||||||
* Check if the mutex is owned by the current thread and can be unlocked
|
* Also check for the ANONYMOUS owner to cover NORMAL mutexes as well. */
|
||||||
*/
|
return ((*mutex)->recursion_counter == 1
|
||||||
return ((*mutex)->recursion_counter == 1 && pthread::equal ((*mutex)->owner, self));
|
&& ((*mutex)->owner == MUTEX_OWNER_ANONYMOUS
|
||||||
|
|| pthread::equal ((*mutex)->owner, self)));
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool
|
inline bool
|
||||||
|
@ -301,21 +301,27 @@ public:
|
|||||||
int type;
|
int type;
|
||||||
int pshared;
|
int pshared;
|
||||||
|
|
||||||
|
pthread_t get_pthread_self () const
|
||||||
|
{
|
||||||
|
return PTHREAD_MUTEX_NORMAL == type ? MUTEX_OWNER_ANONYMOUS :
|
||||||
|
::pthread_self ();
|
||||||
|
}
|
||||||
|
|
||||||
int lock ()
|
int lock ()
|
||||||
{
|
{
|
||||||
return _lock (::pthread_self ());
|
return _lock (get_pthread_self ());
|
||||||
}
|
}
|
||||||
int trylock ()
|
int trylock ()
|
||||||
{
|
{
|
||||||
return _trylock (::pthread_self ());
|
return _trylock (get_pthread_self ());
|
||||||
}
|
}
|
||||||
int unlock ()
|
int unlock ()
|
||||||
{
|
{
|
||||||
return _unlock (::pthread_self ());
|
return _unlock (get_pthread_self ());
|
||||||
}
|
}
|
||||||
int destroy ()
|
int destroy ()
|
||||||
{
|
{
|
||||||
return _destroy (::pthread_self ());
|
return _destroy (get_pthread_self ());
|
||||||
}
|
}
|
||||||
|
|
||||||
void set_owner (pthread_t self)
|
void set_owner (pthread_t self)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user