You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by dr...@hyperreal.org on 1999/10/14 00:49:54 UTC
cvs commit: apache-2.0/src/lib/apr/locks/beos crossproc.c intraproc.c
dreid 99/10/13 15:49:53
Modified: src/lib/apr/locks/beos crossproc.c intraproc.c
Log:
Remove some silly typo's, some naughty tabs that crept in and generally
tidy up. Also start adding in ap_null_cleanup in line with recent
changes.
There is so little difference between intra and inter proc in these
implementations, and I'm not sure that BeOS will ever need different
versions due to the way it works. I'll give it some thought but might
rationalise these into a single set of routines.
Revision Changes Path
1.3 +9 -7 apache-2.0/src/lib/apr/locks/beos/crossproc.c
Index: crossproc.c
===================================================================
RCS file: /home/cvs/apache-2.0/src/lib/apr/locks/beos/crossproc.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- crossproc.c 1999/10/12 06:14:44 1.2
+++ crossproc.c 1999/10/13 22:49:51 1.3
@@ -55,10 +55,12 @@
#include "apr_lock.h"
#include "apr_general.h"
+#include "apr_lib.h"
#include "locks.h"
-ap_status_t lock_inter_cleanup(ap_lock_t *lock)
+ap_status_t lock_inter_cleanup(void * data)
{
+ ap_lock_t *lock = (ap_lock_t*)data;
if (lock->curr_locked == 1) {
if (atomic_add(&lock->ben_interproc , -1) > 1){
release_sem (lock->sem_interproc);
@@ -71,14 +73,14 @@
{
new->sem_interproc = (sem_id)ap_palloc(new->cntxt, sizeof(sem_id));
new->ben_interproc = (int32)ap_palloc(new->cntxt, sizeof(int32));
-
+
new->ben_interproc = 0;
- new->sem_interproc = create_sem(0, "ap_intraproc");
+ new->sem_interproc = create_sem(0, "ap_interproc");
if (new->sem_interproc < B_NO_ERROR){
lock_inter_cleanup(new);
return errno;
}
- new->curr_locked == 0;
+ new->curr_locked = 0;
ap_register_cleanup(new->cntxt, (void *)new, lock_inter_cleanup,
ap_null_cleanup);
return APR_SUCCESS;
@@ -91,18 +93,18 @@
} else {
return errno;
}
- lock->curr_locked == 1;
+ lock->curr_locked = 1;
return APR_SUCCESS;
}
ap_status_t unlock_inter(ap_lock_t *lock)
{
if (atomic_add(&lock->ben_interproc, -1) > 1){
- release_sem(lock->sem_interproc);
+ release_sem(lock->sem_interproc);
+ lock->curr_locked = 0;
} else {
return errno;
}
- lock->curr_locked == 0;
return APR_SUCCESS;
}
1.3 +12 -13 apache-2.0/src/lib/apr/locks/beos/intraproc.c
Index: intraproc.c
===================================================================
RCS file: /home/cvs/apache-2.0/src/lib/apr/locks/beos/intraproc.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- intraproc.c 1999/10/12 06:14:44 1.2
+++ intraproc.c 1999/10/13 22:49:52 1.3
@@ -56,12 +56,11 @@
#include "apr_lock.h"
#include "apr_general.h"
#include "locks.h"
-#include <kernel/OS.h>
-#include <stdio.h>
+#include "apr_lib.h"
-ap_status_t lock_intra_cleanup(ap_lock_t *lock)
+ap_status_t lock_intra_cleanup(void *data)
{
-printf ("lock_intra_cleanup\n");
+ ap_lock_t *lock = (ap_lock_t *)data;
if (lock->curr_locked == 1) {
if (atomic_add(&lock->ben_intraproc , -1) > 1){
release_sem (lock->sem_intraproc);
@@ -85,7 +84,7 @@
return stat;
}
new->sem_intraproc = stat;
- new->curr_locked == 0;
+ new->curr_locked = 0;
ap_register_cleanup(new->cntxt, (void *)new, lock_intra_cleanup,
ap_null_cleanup);
return APR_SUCCESS;
@@ -93,22 +92,22 @@
ap_status_t lock_intra(ap_lock_t *lock)
{
- lock->curr_locked == 1;
- if (atomic_add (&lock->ben_intraproc, 1) >0){
- if (acquire_sem(lock->sem_intraproc) != B_NO_ERROR){
- atomic_add(&lock->ben_intraproc,-1);
+ lock->curr_locked = 1;
+ if (atomic_add (&lock->ben_intraproc, 1) >0){
+ if (acquire_sem(lock->sem_intraproc) != B_NO_ERROR){
+ atomic_add(&lock->ben_intraproc,-1);
return errno;
- }
+ }
}
return APR_SUCCESS;
}
ap_status_t unlock_intra(ap_lock_t *lock)
{
- if (atomic_add(&lock->ben_intraproc, -1) > 1){
- release_sem(lock->sem_intraproc);
+ if (atomic_add(&lock->ben_intraproc, -1) > 1){
+ release_sem(lock->sem_intraproc);
+ lock->curr_locked = 0;
}
- lock->curr_locked == 0;
return APR_SUCCESS;
}