Exemplo n.º 1
0
void EpollDaemon::stop(){
	if(atomicExchange(g_running, false, ATOMIC_ACQ_REL) == false){
		return;
	}
	LOG_POSEIDON(Logger::SP_MAJOR | Logger::LV_INFO, "Stopping epoll daemon...");

	if(g_thread.joinable()){
		g_thread.join();
	}
	g_epoll->clear();
	g_servers.clear();
}
Exemplo n.º 2
0
void EpollDaemon::start(){
	if(atomicExchange(g_running, true, ATOMIC_ACQ_REL) != false){
		LOG_POSEIDON_FATAL("Only one daemon is allowed at the same time.");
		std::abort();
	}
	LOG_POSEIDON(Logger::SP_MAJOR | Logger::LV_INFO, "Starting epoll daemon...");

	MainConfig::get(g_maxTimeout, "epoll_max_timeout");
	LOG_POSEIDON_DEBUG("Max timeout = ", g_maxTimeout);

	MainConfig::get(g_tcpRequestTimeout, "epoll_tcp_request_timeout");
	LOG_POSEIDON_DEBUG("Tcp request timeout = ", g_tcpRequestTimeout);

	Thread(&threadProc, "   N").swap(g_thread);
}
Exemplo n.º 3
0
int addObject (int occlusion, vec4 color, int lastSegmentOffset, coherent int *ptrCell)
{
  //Get stream size and previous node offset
  //Store new stream size and current node offset
  int nodeOffset = atomicAdd( ptrInfo + INFO_COUNTER_STREAMLEN, 5 );
  int prevOffset = atomicExchange( ptrCell + CELL_COUNTER_PREV, nodeOffset );
  coherent float *ptrNode = ptrStream + nodeOffset;

  //Store object data
  ptrNode[ 0 ] = (float) NODE_TYPE_OBJECT;
  ptrNode[ 1 ] = (float) prevOffset;
  ptrNode[ 2 ] = (float) objectId;
  ptrNode[ 3 ] = (float) occlusion;
  ptrNode[ 4 ] = (float) lastSegmentOffset;

  return nodeOffset;
}
Exemplo n.º 4
0
int addLine (vec2 l0, vec2 l1, coherent int *ptrObjCell)
{
  //Get stream size and previous node offset
  //Store new stream size and current node offset
  int nodeOffset = atomicAdd( ptrInfo + INFO_COUNTER_STREAMLEN, 6 );
  int prevOffset = atomicExchange( ptrObjCell + OBJCELL_COUNTER_PREV, nodeOffset );
  coherent float *ptrNode = ptrStream + nodeOffset;

  //Store line data
  ptrNode[ 0 ] = (float) NODE_TYPE_LINE;
  ptrNode[ 1 ] = (float) prevOffset;
  ptrNode[ 2 ] = l0.x;
  ptrNode[ 3 ] = l0.y;
  ptrNode[ 4 ] = l1.x;
  ptrNode[ 5 ] = l1.y;

  return nodeOffset;
}
Exemplo n.º 5
0
int addQuad (vec2 q0, vec2 q1, vec2 q2, coherent int *ptrObjCell)
{
  //Get stream size and previous node offset
  //Store new stream size and current node offset
  int nodeOffset = atomicAdd( ptrInfo + INFO_COUNTER_STREAMLEN, 8 );
  int prevOffset = atomicExchange( ptrObjCell + OBJCELL_COUNTER_PREV, nodeOffset );
  coherent float *ptrNode = ptrStream + nodeOffset;

  //Store quad data
  ptrNode[ 0 ] = (float) NODE_TYPE_QUAD;
  ptrNode[ 1 ] = (float) prevOffset;
  ptrNode[ 2 ] = q0.x;
  ptrNode[ 3 ] = q0.y;
  ptrNode[ 4 ] = q1.x;
  ptrNode[ 5 ] = q1.y;
  ptrNode[ 6 ] = q2.x;
  ptrNode[ 7 ] = q2.y;

  return nodeOffset;
}