Cleanup ACE_HAS_PTHREAD_SIGMASK_PROTOTYPE, all platforms support it so far as I can...
[ACE_TAO.git] / ACE / performance-tests / Synch-Benchmarks / Synch_Lib / Benchmark_Base.cpp
blob43bd16d38e276b0bcf49cd326cd2d784659f5ce9
1 #if !defined (SYNCHLIB_BUILD_DLL)
2 #define SYNCHLIB_BUILD_DLL
3 #endif /* SYNCHLIB_BUILD_DLL */
5 #include "ace/Log_Msg.h"
6 #include "Benchmark_Base.h"
8 #if defined (ACE_HAS_THREADS)
10 // Initialize the static variables.
11 /* static */
13 Benchmark_Base::Benchmark_Base (int type)
14 : benchmark_type_ (type)
18 int
19 Benchmark_Base::benchmark_type ()
21 return this->benchmark_type_;
24 int
25 Benchmark_Base::thr_id ()
27 #if defined (ACE_HAS_PTHREADS) || defined (VXWORKS)
28 // This invokes the thread-specific storage smart pointer.
29 return this->id_->thr_id ();
30 #else
31 return ACE_Thread::self ();
32 #endif /* ACE_HAS_PTHREADS || VXWORKS */
35 Benchmark_Method_Base::Benchmark_Method_Base ()
36 : Benchmark_Base (Benchmark_Base::METHOD)
40 int
41 Benchmark_Method_Base::exec (ACE_Service_Repository_Iterator *sri)
43 sri->advance ();
44 for (const ACE_Service_Type *sr;
45 sri->next (sr) != 0;
46 sri->advance ())
48 // This would greatly benefit from RTTI typesafe downcasting...
49 const ACE_Service_Type_Impl *type = sr->type ();
50 const void *obj = type->object ();
51 ACE_Service_Object *so = (ACE_Service_Object *) obj;
52 Benchmark_Base *bp = (Benchmark_Base *) so;
54 if (this->valid_test_object (bp))
56 ACE_DEBUG ((LM_DEBUG, "\nstarting up %s\n", sr->name ()));
58 int notused = this->pre_run_test (bp) == 0 && this->run_test () == 0 &&
59 this->post_run_test () == 0;
60 notused = notused;
62 else
63 return 0;
65 return 0;
68 #if defined (ACE_HAS_PTHREADS) || defined (VXWORKS)
69 /* static */
70 MT_INT Thr_ID::thread_id_ (0);
72 Thr_ID::Thr_ID ()
73 : thr_id_ (++Thr_ID::thread_id_)
77 int
78 Thr_ID::thr_id ()
80 return this->thr_id_;
83 void
84 Thr_ID::thr_id (int i)
86 this->thr_id_ = i;
89 #endif /* ACE_HAS_PTHREADS || VXWORKS */
90 #endif /* ACE_HAS_THREADS */