diff options
author | William R. Otte <wotte@dre.vanderbilt.edu> | 2008-03-04 13:56:48 +0000 |
---|---|---|
committer | William R. Otte <wotte@dre.vanderbilt.edu> | 2008-03-04 13:56:48 +0000 |
commit | c4078c377d74290ebe4e66da0b4975da91732376 (patch) | |
tree | 1816ef391e42a07929304908ac0e21f4c2f6cb7b /ACE/examples/APG/ThreadSafety/TSS.cpp | |
parent | 700d1c1a6be348c6c70a2085e559baeb8f4a62ea (diff) | |
download | ATCD-c4078c377d74290ebe4e66da0b4975da91732376.tar.gz |
swap in externals for ACE and TAO
Diffstat (limited to 'ACE/examples/APG/ThreadSafety/TSS.cpp')
-rw-r--r-- | ACE/examples/APG/ThreadSafety/TSS.cpp | 75 |
1 files changed, 0 insertions, 75 deletions
diff --git a/ACE/examples/APG/ThreadSafety/TSS.cpp b/ACE/examples/APG/ThreadSafety/TSS.cpp deleted file mode 100644 index 8cc875cb3ee..00000000000 --- a/ACE/examples/APG/ThreadSafety/TSS.cpp +++ /dev/null @@ -1,75 +0,0 @@ -// $Id$ - -#include "ace/config-lite.h" -#if defined (ACE_HAS_THREADS) - -#include "ace/Synch.h" -#include "ace/Task.h" -#include "ClientContext.h" - - -void* -ClientContext::get_attribute (const char *name) -{ - void * value = 0; - attributeMap_.find (name, value); - return value; -} - -void -ClientContext::set_attribute (const char *name, void *value) -{ - attributeMap_.bind (name, value); -} - -// Listing 2 code/ch14 -class HA_CommandHandler : public ACE_Task<ACE_MT_SYNCH> -{ -public: - virtual int svc (void) - { - ACE_thread_t tid = this->thr_mgr ()->thr_self (); - // Set our identifier in TSS. - this->tss_ctx_->set_attribute ("thread_id", &tid); - - while (handle_requests () > 0) - ; - - return 0; - } - - int handle_requests (void) - { - ACE_thread_t *tid = - (ACE_thread_t*)this->tss_ctx_->get_attribute ("thread_id"); - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) TSS TID: %d \n"), - *tid)); - - // do work. - return -1; - } - -private: - ACE_TSS<ClientContext> tss_ctx_; -}; -// Listing 2 - -int ACE_TMAIN (int, ACE_TCHAR *[]) -{ - HA_CommandHandler handler; - handler.activate (THR_NEW_LWP | THR_JOINABLE, 5); - handler.wait (); - return 0; -} - -#else -#include "ace/OS_main.h" -#include "ace/OS_NS_stdio.h" - -int ACE_TMAIN (int, ACE_TCHAR *[]) -{ - ACE_OS::puts (ACE_TEXT ("This example requires threads.")); - return 0; -} - -#endif /* ACE_HAS_THREADS */ |