aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnthony Green <green@cygnus.com>2000-04-09 05:41:56 +0000
committerAnthony Green <green@gcc.gnu.org>2000-04-09 05:41:56 +0000
commit568fe067bc84a419816b46848bbe44b18cd2c80f (patch)
treed99505540e265a3314a56696be14cfaa4bedd148
parentbdf2ced9051950168dda357983e58f234363ef28 (diff)
downloadgcc-568fe067bc84a419816b46848bbe44b18cd2c80f.zip
gcc-568fe067bc84a419816b46848bbe44b18cd2c80f.tar.gz
gcc-568fe067bc84a419816b46848bbe44b18cd2c80f.tar.bz2
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
-rw-r--r--libjava/ChangeLog7
-rw-r--r--libjava/include/posix-threads.h34
-rw-r--r--libjava/posix-threads.cc33
3 files changed, 39 insertions, 35 deletions
diff --git a/libjava/ChangeLog b/libjava/ChangeLog
index e0a3a74..f282e0f 100644
--- a/libjava/ChangeLog
+++ b/libjava/ChangeLog
@@ -1,5 +1,12 @@
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.
(ensureCapacity_unsynchronized): New private method.
(append): Use ensureCapacity_unsynchronized.
diff --git a/libjava/include/posix-threads.h b/libjava/include/posix-threads.h
index 22f6717..03a4390 100644
--- a/libjava/include/posix-threads.h
+++ b/libjava/include/posix-threads.h
@@ -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
diff --git a/libjava/posix-threads.cc b/libjava/posix-threads.cc
index a664ee3..e6b4b25 100644
--- a/libjava/posix-threads.cc
+++ b/libjava/posix-threads.cc
@@ -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)
{