[kaffe] CVS kaffe (guilhem): A few fixes for the semaphore replacement.
Kaffe CVS
cvs-commits at kaffe.org
Mon Nov 22 10:19:17 PST 2004
PatchSet 5469
Date: 2004/11/22 18:15:11
Author: guilhem
Branch: HEAD
Tag: (none)
Log:
A few fixes for the semaphore replacement.
* kaffe/kaffevm/systems/unix-pthreads/thread-internal.h:
Replaced sem_t by repsem_t where needed.
* replace/semaphores.c: Use repsem_t instead of sem_t and
define REPSEM_VALUE_MAX.
Members:
ChangeLog:1.3015->1.3016
kaffe/kaffevm/systems/unix-pthreads/thread-internal.h:1.24->1.25
replace/semaphores.c:1.1->1.2
Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.3015 kaffe/ChangeLog:1.3016
--- kaffe/ChangeLog:1.3015 Mon Nov 22 17:23:26 2004
+++ kaffe/ChangeLog Mon Nov 22 18:15:11 2004
@@ -1,5 +1,13 @@
2004-11-22 Guilhem Lavaux <guilhem at kaffe.org>
+ * kaffe/kaffevm/systems/unix-pthreads/thread-internal.h:
+ Replaced sem_t by repsem_t where needed.
+
+ * replace/semaphores.c: Use repsem_t instead of sem_t and
+ define REPSEM_VALUE_MAX.
+
+2004-11-22 Guilhem Lavaux <guilhem at kaffe.org>
+
* configure.ac:
Call KAFFE_CHECK_SEMAPHORES.
Index: kaffe/kaffe/kaffevm/systems/unix-pthreads/thread-internal.h
diff -u kaffe/kaffe/kaffevm/systems/unix-pthreads/thread-internal.h:1.24 kaffe/kaffe/kaffevm/systems/unix-pthreads/thread-internal.h:1.25
--- kaffe/kaffe/kaffevm/systems/unix-pthreads/thread-internal.h:1.24 Mon Nov 22 17:23:49 2004
+++ kaffe/kaffe/kaffevm/systems/unix-pthreads/thread-internal.h Mon Nov 22 18:15:15 2004
@@ -68,7 +68,7 @@
int interrupting;
/* convars and mutexes aren't useful in signal handlers, semaphores are */
- sem_t sem;
+ repsem_t sem;
/* the following fields hold our extensions */
int active; /* are we in our user thread function 'func'? */
Index: kaffe/replace/semaphores.c
diff -u kaffe/replace/semaphores.c:1.1 kaffe/replace/semaphores.c:1.2
--- kaffe/replace/semaphores.c:1.1 Mon Nov 22 17:24:15 2004
+++ kaffe/replace/semaphores.c Mon Nov 22 18:15:15 2004
@@ -39,11 +39,13 @@
#include "repsemaphore.h"
-int repsem_init(sem_t *sem, int pshared, int value)
+#define REPSEM_VALUE_MAX 32767
+
+int repsem_init(repsem_t *sem, int pshared, int value)
{
int ret;
- if (value > SEM_VALUE_MAX)
+ if (value > REPSEM_VALUE_MAX)
{
errno = EINVAL;
return -1;
@@ -68,12 +70,12 @@
return 0;
}
-int repsem_post(sem_t *sem)
+int repsem_post(repsem_t *sem)
{
if (pthread_mutex_lock(&sem->mutex) < 0)
return -1;
- if (sem->value == SEM_VALUE_MAX)
+ if (sem->value == REPSEM_VALUE_MAX)
{
errno = ERANGE;
return -1;
@@ -92,7 +94,7 @@
return 0;
}
-int repsem_wait(sem_t *sem)
+int repsem_wait(repsem_t *sem)
{
if (pthread_mutex_lock(&sem->mutex) < 0)
return -1;
@@ -109,7 +111,7 @@
return 0;
}
-int repsem_trywait(sem_t *sem)
+int repsem_trywait(repsem_t *sem)
{
if (pthread_mutex_lock(&sem->mutex) < 0)
return -1;
@@ -130,13 +132,13 @@
return 0;
}
-int repsem_getvalue(sem_t *sem, int *sval)
+int repsem_getvalue(repsem_t *sem, int *sval)
{
*sval = sem->value;
return 0;
}
-int repsem_destroy(sem_t *sem)
+int repsem_destroy(repsem_t *sem)
{
int ret;
More information about the kaffe
mailing list