diff options
author | schmidt <douglascraigschmidt@users.noreply.github.com> | 2006-06-09 19:30:09 +0000 |
---|---|---|
committer | schmidt <douglascraigschmidt@users.noreply.github.com> | 2006-06-09 19:30:09 +0000 |
commit | ea18a1d0d482707c6dc9f25f640ed487c20cc306 (patch) | |
tree | ec236b988b1256dce316097d4a9a8942fb71ffc3 | |
parent | c622d5bcf8af74d1958d8de08583bfd8a06f833c (diff) | |
download | ATCD-ea18a1d0d482707c6dc9f25f640ed487c20cc306.tar.gz |
ChangeLogTag:Fri
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | ace/Thread_Manager.cpp | 7 | ||||
-rw-r--r-- | ace/Thread_Manager.h | 48 |
3 files changed, 43 insertions, 18 deletions
diff --git a/ChangeLog b/ChangeLog index 2b056c6ac59..9d5238d86da 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Fri Jun 9 19:25:19 UTC 2006 Douglas C. Schmidt <schmidt@dre.vanderbilt.edu> + + * ace/Thread_Manager.h: Added a new parameter to wait() that + determines whether relative or absolute time is used. Thanks to + Sonicfly Zhou <zhoucn at txsec dot com> for this idea. + Fri Jun 9 14:06:52 UTC 2006 Douglas C. Schmidt <schmidt@dre.vanderbilt.edu> * ace/Hash_Map_With_Allocator_T.{h,inl,cpp}: Enhanced this class diff --git a/ace/Thread_Manager.cpp b/ace/Thread_Manager.cpp index 207c2df8fda..7f824f75eae 100644 --- a/ace/Thread_Manager.cpp +++ b/ace/Thread_Manager.cpp @@ -1735,10 +1735,15 @@ ACE_Thread_Manager::exit (ACE_THR_FUNC_RETURN status, int do_thr_exit) int ACE_Thread_Manager::wait (const ACE_Time_Value *timeout, - int abandon_detached_threads) + int abandon_detached_threads, + int use_absolute_time) { ACE_TRACE ("ACE_Thread_Manager::wait"); + // Check to see if we're using absolute time or not. + if (use_absolute_time == 0 && timeout != 0) + *timeout += ACE_OS::gettimeofday (); + #if !defined (ACE_VXWORKS) ACE_Double_Linked_List<ACE_Thread_Descriptor_Base> term_thr_list_copy; #endif /* ACE_VXWORKS */ diff --git a/ace/Thread_Manager.h b/ace/Thread_Manager.h index 2f3854d0d64..f2805371ef4 100644 --- a/ace/Thread_Manager.h +++ b/ace/Thread_Manager.h @@ -599,25 +599,39 @@ public: int do_thread_exit = 1); /** - * Block until there are no more threads running in the - * <Thread_Manager> or <timeout> expires. Note that <timeout> is - * treated as "absolute" time. Returns 0 on success and -1 on - * failure. If <abandon_detached_threads> is set, wait will first - * check thru its thread list for threads with THR_DETACHED or - * THR_DAEMON flags set and remove these threads. Notice that - * unlike other wait_* function, by default, <wait> does wait on - * all thread spawned by this thread_manager no matter the detached - * flags are set or not unless it is called with - * <abandon_detached_threads> flag set. - * NOTE that if this function is called while the ACE_Object_Manager - * is shutting down (as a result of program rundown via ACE::fini), - * it will not wait for any threads to complete. If you must wait for - * threads spawned by this thread manager to complete and you are in a - * ACE rundown situation (such as your object is being destroyed by the - * ACE_Object_Manager) you can use wait_grp instead. + * Block until there are no more threads running in this thread + * manager or @c timeout expires. + * + * @param timeout is treated as "absolute" time by default, but this + * can be changed to "relative" time by setting the @c + * use_absolute_time to 0. + * @param abandon_detached_threads If non-0, @c wait() will first + * check thru its thread list for + * threads with THR_DETACHED or + * THR_DAEMON flags set and remove + * these threads. Notice that + * unlike other @c wait_*() methods, + * by default, @c wait() does wait on + * all thread spawned by this + * thread manager no matter the detached + * flags are set or not unless it is + * called with @c + * abandon_detached_threads flag set. + * @param use_absolute_time If non-0 then treat @c timeout as + * absolute time, else relative time. + * @return 0 on success * and -1 on failure. + * + * NOTE that if this function is called while the @c + * ACE_Object_Manager is shutting down (as a result of program + * rundown via @c ACE::fini()), it will not wait for any threads to + * complete. If you must wait for threads spawned by this thread + * manager to complete and you are in a ACE rundown situation (such + * as your object is being destroyed by the @c ACE_Object_Manager) + * you can use @c wait_grp() instead. */ int wait (const ACE_Time_Value *timeout = 0, - int abandon_detached_threads = 0); + int abandon_detached_threads = 0, + int use_absolute_time = 1); /// Join a thread specified by <tid>. Do not wait on a detached thread. int join (ACE_thread_t tid, ACE_THR_FUNC_RETURN *status = 0); |