summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorelliott_c <ocielliottc@users.noreply.github.com>2003-04-18 18:38:44 +0000
committerelliott_c <ocielliottc@users.noreply.github.com>2003-04-18 18:38:44 +0000
commit45ab2293681212c41023c26d338c42a3456590a7 (patch)
tree8dd889a7f2685c5c908971de2239263051a9ce53
parent7dad25a0c65e617440441e968f20fbdad6ba6633 (diff)
downloadATCD-45ab2293681212c41023c26d338c42a3456590a7.tar.gz
ChangeLogTag: Fri Apr 18 13:35:51 2003 Chad Elliott <elliott_c@ociweb.com>
-rw-r--r--ChangeLog7
-rw-r--r--ace/OS.cpp64
-rw-r--r--ace/OS.i6
3 files changed, 75 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index fb8cb5a11fa..ec211e8c980 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+Fri Apr 18 13:35:51 2003 Chad Elliott <elliott_c@ociweb.com>
+
+ * ace/OS.i:
+ * ace/OS.cpp:
+
+ Added an implementation of ACE_OS::thr_join() for VxWorks.
+
Fri Apr 18 12:24:02 2003 Chad Elliott <elliott_c@ociweb.com>
* bin/MakeProjectCreator/modules/Driver.pm:
diff --git a/ace/OS.cpp b/ace/OS.cpp
index 801ab5d246d..ef9c4723c2f 100644
--- a/ace/OS.cpp
+++ b/ace/OS.cpp
@@ -821,6 +821,70 @@ ACE_OS::gethostbyname_r (const char *name, hostent *result,
*h_errnop = errno;
return result;
}
+
+// Leave this in the global scope to allow
+// users to adjust the delay value.
+int ACE_THR_JOIN_DELAY = 5;
+
+int
+ACE_OS::thr_join (ACE_hthread_t thr_handle,
+ ACE_THR_FUNC_RETURN *status)
+{
+ // We can't get the status of the thread
+ if (status != 0)
+ {
+ *status = 0;
+ }
+
+ // This method can not support joining all threads
+ if (ACE_OS::thr_cmp (thr_handle, ACE_OS::NULL_hthread))
+ {
+ ACE_NOTSUP_RETURN (-1);
+ }
+
+ int retval = ESRCH;
+ ACE_hthread_t current;
+ ACE_OS::thr_self (current);
+
+ // Make sure we are not joining ourself
+ if (ACE_OS::thr_cmp (thr_handle, current))
+ {
+ retval = EDEADLK;
+ }
+ else
+ {
+ // Whether the task exists or not
+ // we will return a successful value
+ retval = 0;
+
+ // Verify that the task id still exists
+ while (taskIdVerify (thr_handle) == OK)
+ {
+ // Wait a bit to see if the task is still active.
+ ACE_OS::sleep (ACE_THR_JOIN_DELAY);
+ }
+ }
+
+ // Adapt the return value into errno and return value.
+ // The ACE_ADAPT_RETVAL macro doesn't exactly do what
+ // we need to do here, so we do it manually.
+ if (retval != 0)
+ {
+ errno = retval;
+ retval = -1;
+ }
+
+ return retval;
+}
+
+int
+ACE_OS::thr_join (ACE_thread_t waiter_id,
+ ACE_thread_t *thr_id,
+ ACE_THR_FUNC_RETURN *status)
+{
+ thr_id = 0;
+ return ACE_OS::thr_join (taskNameToId (waiter_id), status);
+}
#endif /* VXWORKS */
void
diff --git a/ace/OS.i b/ace/OS.i
index b2674e190b8..6c1ce286e30 100644
--- a/ace/OS.i
+++ b/ace/OS.i
@@ -6741,6 +6741,7 @@ ACE_OS::thr_getspecific (ACE_thread_key_t key, void **data)
#endif /* ACE_HAS_THREADS */
}
+#if !defined (VXWORKS)
ACE_INLINE int
ACE_OS::thr_join (ACE_hthread_t thr_handle,
ACE_THR_FUNC_RETURN *status)
@@ -6797,7 +6798,7 @@ ACE_OS::thr_join (ACE_hthread_t thr_handle,
}
ACE_FAIL_RETURN (-1);
/* NOTREACHED */
-# elif defined (VXWORKS) || defined (ACE_PSOS)
+# elif defined (ACE_PSOS)
ACE_UNUSED_ARG (thr_handle);
ACE_UNUSED_ARG (status);
ACE_NOTSUP_RETURN (-1);
@@ -6845,7 +6846,7 @@ ACE_OS::thr_join (ACE_thread_t waiter_id,
// This could be implemented if the DLL-Main function or the
// task exit base class some log the threads which have exited
ACE_NOTSUP_RETURN (-1);
-# elif defined (VXWORKS) || defined (ACE_PSOS)
+# elif defined (ACE_PSOS)
ACE_UNUSED_ARG (waiter_id);
ACE_UNUSED_ARG (thr_id);
ACE_UNUSED_ARG (status);
@@ -6858,6 +6859,7 @@ ACE_OS::thr_join (ACE_thread_t waiter_id,
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_HAS_THREADS */
}
+#endif /* !VXWORKS */
ACE_INLINE int
ACE_OS::thr_setcancelstate (int new_state, int *old_state)