1 #define ACE_BUILD_SVC_DLL
2 #include "ace/SV_Semaphore_Simple.h"
3 #include "Performance_Test_Options.h"
4 #include "Benchmark_Performance.h"
6 #if defined (ACE_HAS_THREADS)
8 class ACE_Svc_Export SYSVSema_Test
: public Benchmark_Performance
11 virtual int init (int, ACE_TCHAR
*[]);
16 static ACE_SV_Semaphore_Simple
*sema
;
20 ACE_SV_Semaphore_Simple
*SYSVSema_Test::sema
= 0;
23 SYSVSema_Test::init (int, ACE_TCHAR
*[])
25 #if defined (ACE_HAS_SYSV_IPC)
26 ACE_NEW_RETURN (SYSVSema_Test::sema
, ACE_SV_Semaphore_Simple ((key_t
) 1234), -1);
29 ACE_ERROR_RETURN ((LM_ERROR
, "SysV Semaphore not supported on this platform.\n"), -1);
30 #endif /* ACE_HAS_SYSV_IPC */
34 SYSVSema_Test::fini ()
36 delete SYSVSema_Test::sema
;
43 int ni
= this->thr_id ();
46 while (!this->done ())
48 SYSVSema_Test::sema
->acquire ();
49 performance_test_options
.thr_work_count
[ni
]++;
51 SYSVSema_Test::sema
->release ();
54 SYSVSema_Test::sema
->remove ();
59 ACE_SVC_FACTORY_DECLARE (SYSVSema_Test
)
60 ACE_SVC_FACTORY_DEFINE (SYSVSema_Test
)
62 // ACE_Service_Object_Type st (&sysvsema_test, "SYSVSema_Test");
63 #endif /* ACE_HAS_THREADS */