mirror of
https://gcc.gnu.org/git/gcc.git
synced 2024-11-27 05:44:15 +08:00
posix-threads.cc (_Jv_MutexLock): Moved back to posix-threads.h.
2000-04-08 Anthony Green <green@cygnus.com> * posix-threads.cc (_Jv_MutexLock): Moved back to posix-threads.h. (_Jv_MutexUnlock): Ditto. * include/posix-threads.h (_Jv_MutexLock): From posix-threads.cc. (_Jv_MutexUnlock): Ditto. From-SVN: r33037
This commit is contained in:
parent
bdf2ced905
commit
568fe067bc
@ -1,3 +1,10 @@
|
||||
2000-04-08 Anthony Green <green@cygnus.com>
|
||||
|
||||
* posix-threads.cc (_Jv_MutexLock): Moved back to posix-threads.h.
|
||||
(_Jv_MutexUnlock): Ditto.
|
||||
* include/posix-threads.h (_Jv_MutexLock): From posix-threads.cc.
|
||||
(_Jv_MutexUnlock): Ditto.
|
||||
|
||||
2000-04-08 Anthony Green <green@cygnus.com>
|
||||
|
||||
* java/lang/StringBuffer.java (ensureCapacity): Don't call Math::max.
|
||||
|
@ -115,8 +115,38 @@ _Jv_MutexInit (_Jv_Mutex_t *mu)
|
||||
mu->owner = 0;
|
||||
}
|
||||
|
||||
int _Jv_MutexLock (_Jv_Mutex_t *mu);
|
||||
int _Jv_MutexUnlock (_Jv_Mutex_t *mu);
|
||||
inline int
|
||||
_Jv_MutexLock (_Jv_Mutex_t *mu)
|
||||
{
|
||||
pthread_t self = pthread_self ();
|
||||
if (mu->owner == self)
|
||||
{
|
||||
mu->count++;
|
||||
}
|
||||
else
|
||||
{
|
||||
pthread_mutex_lock (&mu->mutex);
|
||||
mu->count = 1;
|
||||
mu->owner = self;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
inline int
|
||||
_Jv_MutexUnlock (_Jv_Mutex_t *mu)
|
||||
{
|
||||
if (_Jv_PthreadCheckMonitor (mu))
|
||||
return _JV_NOT_OWNER;
|
||||
|
||||
mu->count--;
|
||||
|
||||
if (mu->count == 0)
|
||||
{
|
||||
mu->owner = 0;
|
||||
pthread_mutex_unlock (&mu->mutex);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifndef LINUX_THREADS
|
||||
|
||||
|
@ -402,39 +402,6 @@ _Jv_ThreadStart (java::lang::Thread *thread, _Jv_Thread_t *data,
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
_Jv_MutexLock (_Jv_Mutex_t *mu)
|
||||
{
|
||||
pthread_t self = pthread_self ();
|
||||
if (mu->owner == self)
|
||||
{
|
||||
mu->count++;
|
||||
}
|
||||
else
|
||||
{
|
||||
pthread_mutex_lock (&mu->mutex);
|
||||
mu->count = 1;
|
||||
mu->owner = self;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
_Jv_MutexUnlock (_Jv_Mutex_t *mu)
|
||||
{
|
||||
if (_Jv_PthreadCheckMonitor (mu))
|
||||
return _JV_NOT_OWNER;
|
||||
|
||||
mu->count--;
|
||||
|
||||
if (mu->count == 0)
|
||||
{
|
||||
mu->owner = 0;
|
||||
pthread_mutex_unlock (&mu->mutex);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
_Jv_ThreadWait (void)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user