summaryrefslogtreecommitdiff
path: root/TSRM
diff options
context:
space:
mode:
authorVenkat Raghavan S <rvenkat@php.net>2002-05-28 08:54:17 +0000
committerVenkat Raghavan S <rvenkat@php.net>2002-05-28 08:54:17 +0000
commitd69261d12c23cf80e9291de40f033e390ce114f1 (patch)
treea1682b4d4fc489534f97e22b95d3324967685f89 /TSRM
parentc223987fa2ebe0fdae56ad182aab5be1631ba049 (diff)
downloadphp-git-d69261d12c23cf80e9291de40f033e390ce114f1.tar.gz
Basic NetWare changes
Diffstat (limited to 'TSRM')
-rw-r--r--TSRM/TSRM.c15
-rw-r--r--TSRM/TSRM.h6
2 files changed, 21 insertions, 0 deletions
diff --git a/TSRM/TSRM.c b/TSRM/TSRM.c
index 65447c6df0..6af686b035 100644
--- a/TSRM/TSRM.c
+++ b/TSRM/TSRM.c
@@ -412,6 +412,8 @@ TSRM_API THREAD_T tsrm_thread_id(void)
{
#ifdef TSRM_WIN32
return GetCurrentThreadId();
+#elif defined(NETWARE)
+ return NXThreadGetId();
#elif defined(GNUPTH)
return pth_self();
#elif defined(PTHREADS)
@@ -430,10 +432,17 @@ TSRM_API THREAD_T tsrm_thread_id(void)
TSRM_API MUTEX_T tsrm_mutex_alloc(void)
{
MUTEX_T mutexp;
+#ifdef NETWARE
+ long flags = 0; /* Don't require NX_MUTEX_RECURSIVE, I guess */
+ NXHierarchy_t order = 0;
+ NX_LOCK_INFO_ALLOC (lockInfo, "PHP-TSRM", 0);
+#endif
#ifdef TSRM_WIN32
mutexp = malloc(sizeof(CRITICAL_SECTION));
InitializeCriticalSection(mutexp);
+#elif defined(NETWARE)
+ mutexp = NXMutexAlloc(flags, order, &lockInfo); /* return value ignored for now */
#elif defined(GNUPTH)
mutexp = (MUTEX_T) malloc(sizeof(*mutexp));
pth_mutex_init(mutexp);
@@ -460,6 +469,8 @@ TSRM_API void tsrm_mutex_free(MUTEX_T mutexp)
if (mutexp) {
#ifdef TSRM_WIN32
DeleteCriticalSection(mutexp);
+#elif defined(NETWARE)
+ NXMutexFree(mutexp);
#elif defined(GNUPTH)
free(mutexp);
#elif defined(PTHREADS)
@@ -486,6 +497,8 @@ TSRM_API int tsrm_mutex_lock(MUTEX_T mutexp)
#ifdef TSRM_WIN32
EnterCriticalSection(mutexp);
return 1;
+#elif defined(NETWARE)
+ return NXLock(mutexp);
#elif defined(GNUPTH)
return pth_mutex_acquire(mutexp, 0, NULL);
#elif defined(PTHREADS)
@@ -507,6 +520,8 @@ TSRM_API int tsrm_mutex_unlock(MUTEX_T mutexp)
#ifdef TSRM_WIN32
LeaveCriticalSection(mutexp);
return 1;
+#elif defined(NETWARE)
+ return NXUnlock(mutexp);
#elif defined(GNUPTH)
return pth_mutex_release(mutexp);
#elif defined(PTHREADS)
diff --git a/TSRM/TSRM.h b/TSRM/TSRM.h
index eed6986a6a..6d6ee56242 100644
--- a/TSRM/TSRM.h
+++ b/TSRM/TSRM.h
@@ -36,6 +36,9 @@
#ifdef TSRM_WIN32
# include <windows.h>
+#elif defined(NETWARE)
+# include <nks/thread.h>
+# include <nks/synch.h>
#elif defined(GNUPTH)
# include <pth.h>
#elif defined(PTHREADS)
@@ -50,6 +53,9 @@ typedef int ts_rsrc_id;
#ifdef TSRM_WIN32
# define THREAD_T DWORD
# define MUTEX_T CRITICAL_SECTION *
+#elif defined(NETWARE)
+# define THREAD_T NXThreadId_t
+# define MUTEX_T NXMutex_t *
#elif defined(GNUPTH)
# define THREAD_T pth_t
# define MUTEX_T pth_mutex_t *