1 #define ACE_BUILD_SVC_DLL
2 #include "Performance_Test_Options.h"
3 #include "Benchmark_Performance.h"
5 #if defined (ACE_HAS_THREADS)
7 class ACE_Svc_Export Cond_Brdcast_Test
: public Benchmark_Performance
13 static ACE_Thread_Mutex mutex
;
16 static ACE_Condition_Thread_Mutex notfull
;
17 static ACE_Condition_Thread_Mutex notempty
;
20 ACE_Thread_Mutex
Cond_Brdcast_Test::mutex
;
21 int Cond_Brdcast_Test::resources
;
22 ACE_Condition_Thread_Mutex
Cond_Brdcast_Test::notfull (Cond_Brdcast_Test::mutex
);
23 ACE_Condition_Thread_Mutex
Cond_Brdcast_Test::notempty (Cond_Brdcast_Test::mutex
);
26 Cond_Brdcast_Test::svc ()
28 int ni
= this->thr_id ();
31 // Special case for first thread...
33 while (!this->done ())
38 performance_test_options
.thr_work_count
[ni
]++;
39 resources
= performance_test_options
.thr_count () - 1;
41 notempty
.broadcast ();
45 while (!this->done ())
48 while (resources
== 0)
50 performance_test_options
.thr_work_count
[ni
]++;
61 ACE_SVC_FACTORY_DECLARE (Cond_Brdcast_Test
)
62 ACE_SVC_FACTORY_DEFINE (Cond_Brdcast_Test
)
64 // ACE_Service_Object_Type cbt (&cond_brdcast_test, "Condition_Broadcast_Test");
65 #endif /* ACE_HAS_THREADS */