trawick 01/06/14 11:52:13
Modified: include apr_portable.h
locks/unix locks.c
threadproc/beos thread.c
threadproc/unix thread.c
Log:
on some Unix platforms pthread_t is a structure and the compiler won't allow
comparison of structures
add apr_os_thread_equal() and implement it on the two platforms with
apr_os_thread_current()
use apr_os_thread_equal() in the Unix lock code so we don't compare
structures
Revision Changes Path
1.58 +1 -0 apr/include/apr_portable.h
Index: apr_portable.h
===================================================================
RCS file: /home/cvs/apr/include/apr_portable.h,v
retrieving revision 1.57
retrieving revision 1.58
diff -u -r1.57 -r1.58
--- apr_portable.h 2001/06/11 11:41:12 1.57
+++ apr_portable.h 2001/06/14 18:51:50 1.58
@@ -416,6 +416,7 @@
#if APR_HAS_THREADS
APR_DECLARE(apr_os_thread_t) apr_os_thread_current(void);
+APR_DECLARE(int) apr_os_thread_equal(apr_os_thread_t tid1, apr_os_thread_t
tid2);
#endif
#endif /* APR_HAS_DSO */
1.53 +3 -3 apr/locks/unix/locks.c
Index: locks.c
===================================================================
RCS file: /home/cvs/apr/locks/unix/locks.c,v
retrieving revision 1.52
retrieving revision 1.53
diff -u -r1.52 -r1.53
--- locks.c 2001/06/07 02:39:00 1.52
+++ locks.c 2001/06/14 18:51:58 1.53
@@ -131,7 +131,7 @@
apr_status_t stat;
#if APR_HAS_THREADS
- if (lock->owner == apr_os_thread_current()){
+ if (apr_os_thread_equal(lock->owner, apr_os_thread_current())) {
lock->owner_ref++;
return APR_SUCCESS;
}
@@ -204,7 +204,7 @@
apr_status_t stat;
#if APR_HAS_THREADS
- if (lock->owner == apr_os_thread_current()) {
+ if (apr_os_thread_equal(lock->owner, apr_os_thread_current())) {
lock->owner_ref--;
if (lock->owner_ref > 0)
return APR_SUCCESS;
@@ -244,7 +244,7 @@
}
#if APR_HAS_THREADS
- lock->owner = 0;
+ memset(&lock->owner, 0, sizeof lock->owner);
lock->owner_ref = 0;
#endif
1.22 +5 -0 apr/threadproc/beos/thread.c
Index: thread.c
===================================================================
RCS file: /home/cvs/apr/threadproc/beos/thread.c,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- thread.c 2001/06/06 18:12:08 1.21
+++ thread.c 2001/06/14 18:52:05 1.22
@@ -128,6 +128,11 @@
return find_thread(NULL);
}
+int apr_os_thread_equal(apr_os_thread_t tid1, apr_os_thread_t tid2)
+{
+ return tid1 == tid2;
+}
+
apr_status_t apr_thread_exit(apr_thread_t *thd, apr_status_t *retval)
{
apr_pool_destroy(thd->cntxt);
1.39 +5 -0 apr/threadproc/unix/thread.c
Index: thread.c
===================================================================
RCS file: /home/cvs/apr/threadproc/unix/thread.c,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -r1.38 -r1.39
--- thread.c 2001/06/06 18:12:14 1.38
+++ thread.c 2001/06/14 18:52:09 1.39
@@ -163,6 +163,11 @@
return pthread_self();
}
+int apr_os_thread_equal(apr_os_thread_t tid1, apr_os_thread_t tid2)
+{
+ return pthread_equal(tid1, tid2);
+}
+
apr_status_t apr_thread_exit(apr_thread_t *thd, apr_status_t *retval)
{
apr_pool_destroy(thd->cntxt);