[Ace-users] [ace-users] Proactor on WIN32 with multiprocessor Xeon - anyonegot this working?
JR Andreassen
janrune at io.com
Tue Jan 29 14:17:08 CST 2008
Hi...
I solved this problem by broadcasting a shutdown:
Like such:
broadcastSignal(SIGTERM, 0);
// --------------------------------------------------------------
/**
* Broadcast Signal(sig) to all tasks
* @param sig Signal to broadcast.
* @param ignored_suspended Flag to determine wether to ignore
suspended tasks.
* @return int Number ot tasks notified.
*/
int broadcastSignal(int signum, int ignored_suspended)
{
int retVal = 0;
ACE_Service_Object* svoTest = NULL;
ACE_Event_Handler* handler = NULL;
ACE_Task_Base* taskbase = NULL;
ACE_Service_Repository* svcs_repository =
ACE_Service_Repository::instance();
const ACE_Service_Type_Impl * srpI = NULL;
const ACE_Service_Type* srp = NULL;
if(svcs_repository != NULL)
{
ACE_Service_Repository_Iterator repIter(*svcs_repository,
ignored_suspended);
for(;repIter.next(srp) > 0;repIter.advance())
{
srpI = srp->type();
if(!ISNULL(srpI))
{
svoTest = static_cast<ACE_Service_Object*>(srpI->object());
if(!ISNULL(svoTest))
{
handler = dynamic_cast<ACE_Event_Handler*>(svoTest);
if(!ISNULL (handler))
{ handler->handle_signal(signum); }
Sleep(0);
retVal++;
}
}
}
Sleep(0);
}
return retVal;
}
Alexander Libman wrote:
>Hi Chris,
>The Proactor_Test does not perform gracefull shutdown.
>It may work for single CPU platform, but easily can have access violation on
>multi-CPU box.
>The problem is that Proactor_Test starts to delete Client/Server instances
>while completion callbacks can be active
>in Proactor_Task thread pool.
>The correct solution can be two step shutdown process:
>a) initiate cancellation of all pending operation using cancel() and
>closesocket() methods
> (you should use both of them as Windows CancelIO() could have no effect )
>b) waiting on special event/condition when all Clients/Servers are
>self-destroyed.
>
>Regards,
>Alex
>
>_______________________________________________
>ace-users mailing list
>ace-users at mail.cse.wustl.edu
>http://mail.cse.wustl.edu/mailman/listinfo/ace-users
>
>
>
More information about the Ace-users
mailing list