rbb 99/07/27 11:46:24
Modified:apr/threadproc/unix thread.c threadcancel.c threadpriv.c
Log:
Make all thread functions a no-op on platforms without pthreads. Hopefully,
someday this will change to a user-land threads library, but this will work
for now. I am returning APR_SUCCESS for now, that may change too.
Revision ChangesPath
1.12 +77 -0 apache-apr/apr/threadproc/unix/thread.c
Index: thread.c
===
RCS file: /home/cvs/apache-apr/apr/threadproc/unix/thread.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- thread.c 1999/07/06 17:01:41 1.11
+++ thread.c 1999/07/27 18:46:22 1.12
@@ -58,6 +58,7 @@
#include apr_general.h
#include apr_portable.h
+#ifdef HAVE_PTHREAD_H
ap_status_t ap_create_threadattr(ap_context_t *cont, struct threadattr_t
**new)
{
ap_status_t stat;
@@ -226,4 +227,80 @@
(*thd)-td = thethd;
return APR_SUCCESS;
}
+#else
+/* No pthread.h, no threads for right now.*/
+ap_status_t ap_create_threadattr(ap_context_t *cont, struct threadattr_t
**new)
+{
+*new = NULL;
+return APR_SUCCESS;
+}
+
+ap_status_t ap_setthreadattr_detach(struct threadattr_t *attr, ap_int32_t on)
+{
+return APR_SUCCESS;
+}
+
+ap_status_t ap_getthreadattr_detach(struct threadattr_t *attr)
+{
+return APR_NOTDETACH;
+}
+
+ap_status_t ap_create_thread(ap_context_t *cont, struct threadattr_t *attr,
+ ap_thread_start_t func, void *data,
+ struct thread_t **new)
+{
+*new = NULL;
+return stat;
+}
+
+ap_status_t ap_thread_exit(ap_thread_t *thd, ap_status_t *retval)
+{
+APR_SUCCESS;
+}
+
+ap_status_t ap_thread_join(struct thread_t *thd, ap_status_t *retval)
+{
+return APR_SUCCESS;
+}
+
+ap_status_t ap_thread_detach(struct thread_t *thd)
+{
+return APR_SUCCESS;
+}
+
+/* ***APRDOC
+ * ap_status_t ap_get_threaddata(ap_thread_t *, void *)
+ *Return the context associated with the current thread.
+ * arg 1) The currently open thread.
+ * arg 2) The user data associated with the thread.
+ */
+ap_status_t ap_get_threaddata(struct thread_t *thread, void *data)
+{
+data = NULL;
+return APR_ENOTHREAD;
+}
+
+/* ***APRDOC
+ * ap_status_t ap_set_threaddata(ap_thread_t *, void *)
+ *Return the context associated with the current thread.
+ * arg 1) The currently open thread.
+ * arg 2) The user data to associate with the thread.
+ */
+ap_status_t ap_set_threaddata(struct thread_t *thread, void *data)
+{
+return APR_ENOTHREAD;
+}
+
+ap_status_t ap_get_os_thread(struct thread_t *thd, ap_os_thread_t *thethd)
+{
+thethd = NULL;
+return APR_SUCCESS;
+}
+
+ap_status_t ap_put_os_thread(ap_context_t *cont, struct thread_t **thd,
+ ap_os_thread_t *thethd)
+{
+return APR_SUCCESS;
+}
+#endif
1.5 +17 -2 apache-apr/apr/threadproc/unix/threadcancel.c
Index: threadcancel.c
===
RCS file: /home/cvs/apache-apr/apr/threadproc/unix/threadcancel.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- threadcancel.c1999/05/25 17:04:03 1.4
+++ threadcancel.c1999/07/27 18:46:23 1.5
@@ -57,7 +57,7 @@
#include apr_thread_proc.h
#include apr_general.h
-
+#ifdef HAVE_PTHREAD_H
ap_status_t ap_cancel_thread(struct thread_t *thd)
{
ap_status_t stat;
@@ -68,7 +68,6 @@
return stat;
}
}
-
ap_status_t ap_setcanceltype(ap_context_t *cont, ap_int32_t type)
{
@@ -91,4 +90,20 @@
return stat;
}
}
+#else
+ap_status_t ap_cancel_thread(struct thread_t *thd)
+{
+return APR_SUCCESS;
+}
+
+ap_status_t ap_setcanceltype(ap_context_t *cont, ap_int32_t type)
+{
+return APR_SUCCESS;
+}
+
+ap_status_t ap_setcancelstate(ap_context_t *cont, ap_int32_t type)
+{
+return APR_SUCCESS;
+}
+#endif
1.10 +58 -0 apache-apr/apr/threadproc/unix/threadpriv.c
Index: threadpriv.c
===
RCS file: /home/cvs/apache-apr/apr/threadproc/unix/threadpriv.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- threadpriv.c 1999/07/06 17:01:41 1.9
+++ threadpriv.c 1999/07/27 18:46:23 1.10
@@ -59,6 +59,7 @@
#include apr_errno.h
#include apr_portable.h
+#ifdef HAVE_PTHREAD_H
ap_status_t ap_create_thread_private(ap_context_t *cont, void (*dest)(void
*),