namespace
{
-command_server *global_server;
+command_server *global_server = NULL;
string testfunc(const string& str)
{
ret=str+", testfunc() was here";
// call handle, eventually reentrant
- global_server->handle(1000);
+ if (global_server)
+ global_server->handle(1000);
return ret;
}
// child
{
// wait till server is up
- sleep(1);
+ sleep(3);
// we want 8 identical childs hammering the server
fork();
long long maxtime=5000000;
while(maxtime > 0)
cs.handle(maxtime,&maxtime);
+
+ global_server = NULL;
}
// we are still alive, everything is ok