diff options
Diffstat (limited to 'tests/Task_Ex_Test.cpp')
-rw-r--r-- | tests/Task_Ex_Test.cpp | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/tests/Task_Ex_Test.cpp b/tests/Task_Ex_Test.cpp index 1b8d4f97322..efa01f9ba86 100644 --- a/tests/Task_Ex_Test.cpp +++ b/tests/Task_Ex_Test.cpp @@ -11,7 +11,7 @@ // = DESCRIPTION // This test program illustrates the ACE_Task_Ex class which has the ACE_Message_Queue_Ex // that has the capability to hold user-defined messages instead of ACE_Message_Block -// +// // // = AUTHOR // Kobi Cohen-Arazi <kobi-co@barak-online.net> @@ -29,9 +29,16 @@ ACE_RCSID(tests, Task_Test_Ex, "$Id$") #if defined (ACE_HAS_THREADS) /// default params +#if defined (ACE_VXWORKS) +// this is a very expensive test on VxWorks so limit it otherwise it will never finish in time:-) +const ACE_INT32 PRODUCER_THREADS_NO=10; +const ACE_INT32 CONSUMER_THREADS_NO=10; +const ACE_INT32 NUMBER_OF_MSGS=200; +#else const ACE_INT32 PRODUCER_THREADS_NO=20; const ACE_INT32 CONSUMER_THREADS_NO=20; const ACE_INT32 NUMBER_OF_MSGS=2000; +#endif /// @class Consumer consumes user defined Msgs class Consumer : public ACE_Task_Ex<ACE_MT_SYNCH, User_Defined_Msg> @@ -66,14 +73,14 @@ int Consumer::svc () { ACE_ASSERT (pMsg!=0); auto_ptr<User_Defined_Msg> pAuto(pMsg); - ACE_DEBUG((LM_DEBUG, + ACE_DEBUG((LM_DEBUG, ACE_TEXT("Consumer::svc got msg id=%d\n"), pMsg->msg_id ())); if(pMsg->msg_id ()==NUMBER_OF_MSGS-1) break; } - ACE_DEBUG((LM_INFO, + ACE_DEBUG((LM_INFO, ACE_TEXT("Consumer::svc ended thread %t\n"))); return 0; @@ -83,7 +90,7 @@ int Consumer::svc () /// producer function produces user defined messages. ACE_THR_FUNC_RETURN producer (void *arg) { - Consumer* c = ACE_static_cast (Consumer*, arg); + Consumer* c = static_cast<Consumer*> (arg); ACE_ASSERT(c!=0); if (c==0) { @@ -133,17 +140,17 @@ run_main (int, ACE_TCHAR *[]) Consumer c; if(c.open (0)==-1) - ACE_ERROR_RETURN((LM_ERROR, + ACE_ERROR_RETURN((LM_ERROR, ACE_TEXT ("main Error opening consumer\n")),-1); - - + + int result=ACE_Thread_Manager::instance()->spawn_n (PRODUCER_THREADS_NO, ACE_THR_FUNC(producer), - ACE_static_cast(void*,&c)); + static_cast<void*> (&c)); if (result==-1) { - ACE_ERROR_RETURN((LM_ERROR, - ACE_TEXT ("main Error spawning threads %p\n"), + ACE_ERROR_RETURN((LM_ERROR, + ACE_TEXT ("main Error spawning threads %p\n"), "err="),-1); } |