summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbnicholes <bnicholes@13f79535-47bb-0310-9956-ffa450edef68>2002-02-08 22:12:31 +0000
committerbnicholes <bnicholes@13f79535-47bb-0310-9956-ffa450edef68>2002-02-08 22:12:31 +0000
commitf7a66186197a7411444575b5f7ff5ab3eae1a8e1 (patch)
tree0094687484a7a8516ddcf60a4a2e81c5809de212
parent03f60180b896a985b471ce0cfedb58f34df4dd44 (diff)
downloadlibapr-f7a66186197a7411444575b5f7ff5ab3eae1a8e1.tar.gz
Piggy-backed the proc_mutexes on the thread_mutexes since all resources
are shared on NetWare. There is no difference between a thread mutex and a proc mutex. git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@62937 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--include/arch/netware/proc_mutex.h3
-rw-r--r--locks/netware/proc_mutex.c43
2 files changed, 35 insertions, 11 deletions
diff --git a/include/arch/netware/proc_mutex.h b/include/arch/netware/proc_mutex.h
index 9fbb808b4..7077f7b54 100644
--- a/include/arch/netware/proc_mutex.h
+++ b/include/arch/netware/proc_mutex.h
@@ -56,10 +56,11 @@
#define PROC_MUTEX_H
#include "apr_proc_mutex.h"
-#include <nks/synch.h>
+#include "apr_thread_mutex.h"
struct apr_proc_mutex_t {
apr_pool_t *pool;
+ apr_thread_mutex_t *mutex;
};
#endif /* PROC_MUTEX_H */
diff --git a/locks/netware/proc_mutex.c b/locks/netware/proc_mutex.c
index 77022122a..fd7b270cf 100644
--- a/locks/netware/proc_mutex.c
+++ b/locks/netware/proc_mutex.c
@@ -54,44 +54,65 @@
#include "apr.h"
#include "apr_private.h"
-#include "apr_general.h"
-#include "apr_strings.h"
-#include "proc_mutex.h"
#include "apr_portable.h"
+#include "proc_mutex.h"
+#include "thread_mutex.h"
APR_DECLARE(apr_status_t) apr_proc_mutex_create(apr_proc_mutex_t **mutex,
const char *fname,
apr_lockmech_e mech,
apr_pool_t *pool)
{
- return APR_ENOTIMPL;
+ apr_status_t ret;
+ apr_proc_mutex_t *new_mutex = NULL;
+ new_mutex = (apr_proc_mutex_t *)apr_pcalloc(pool, sizeof(apr_proc_mutex_t));
+
+ if(new_mutex ==NULL) {
+ return APR_ENOMEM;
+ }
+
+ new_mutex->pool = pool;
+ ret = apr_thread_mutex_create(&(new_mutex->mutex), APR_THREAD_MUTEX_DEFAULT, pool);
+
+ if (ret == APR_SUCCESS)
+ *mutex = new_mutex;
+
+ return ret;
}
APR_DECLARE(apr_status_t) apr_proc_mutex_child_init(apr_proc_mutex_t **mutex,
const char *fname,
apr_pool_t *pool)
{
- return APR_ENOTIMPL;
+ return APR_SUCCESS;
}
APR_DECLARE(apr_status_t) apr_proc_mutex_lock(apr_proc_mutex_t *mutex)
{
- return APR_ENOTIMPL;
+ if (mutex)
+ return apr_thread_mutex_lock(mutex->mutex);
+ return APR_ENOLOCK;
}
APR_DECLARE(apr_status_t) apr_proc_mutex_trylock(apr_proc_mutex_t *mutex)
{
- return APR_ENOTIMPL;
+ if (mutex)
+ return apr_thread_mutex_trylock(mutex->mutex);
+ return APR_ENOLOCK;
}
APR_DECLARE(apr_status_t) apr_proc_mutex_unlock(apr_proc_mutex_t *mutex)
{
- return APR_ENOTIMPL;
+ if (mutex)
+ return apr_thread_mutex_unlock(mutex->mutex);
+ return APR_ENOLOCK;
}
APR_DECLARE(apr_status_t) apr_proc_mutex_destroy(apr_proc_mutex_t *mutex)
{
- return APR_ENOTIMPL;
+ if (mutex)
+ return apr_thread_mutex_destroy(mutex->mutex);
+ return APR_ENOLOCK;
}
APR_POOL_IMPLEMENT_ACCESSOR(proc_mutex)
@@ -101,7 +122,9 @@ APR_POOL_IMPLEMENT_ACCESSOR(proc_mutex)
apr_status_t apr_os_proc_mutex_get(apr_os_proc_mutex_t *ospmutex,
apr_proc_mutex_t *pmutex)
{
- return APR_ENOTIMPL;
+ if (pmutex)
+ ospmutex = pmutex->mutex->mutex;
+ return APR_ENOLOCK;
}
apr_status_t apr_os_proc_mutex_put(apr_proc_mutex_t **pmutex,