//-------------------------------------------------------------------------- // Main global function //-------------------------------------------------------------------------- S3E_MAIN_DECL void IwMain() { #ifdef EXAMPLE_DEBUG_ONLY // Test for Debug only examples #endif onInit(); while (1) { s3eDeviceYield(0); s3eKeyboardUpdate(); bool result = onUpdate(); if ( (result == false) || (s3eKeyboardGetState(s3eKeyEsc) & S3E_KEY_STATE_DOWN) || (s3eKeyboardGetState(s3eKeyLSK) & S3E_KEY_STATE_DOWN) || (s3eDeviceCheckQuitRequest()) ) { break; } onRender(); s3eSurfaceShow(); } onShutDown(); }
int StorageHandler::SendEvent(const Event* event) { /* * TODO: Use multimessage instead of creating a separate buffer and copying the MEP data into it */ const EVENT_HDR* data = EventSerializer::SerializeEvent(event); /* * Send the event to the merger with a zero copy message */ zmq::message_t zmqMessage((void*) data, data->length * 4, (zmq::free_fn*) ZMQHandler::freeZmqMessage); while (ZMQHandler::IsRunning()) { tbb::spin_mutex::scoped_lock my_lock(sendMutex_); try { mergerSockets_[event->getBurstID() % mergerSockets_.size()]->send(zmqMessage); break; } catch (const zmq::error_t& ex) { if (ex.num() != EINTR) { // try again if EINTR (signal caught) LOG_ERROR<< ex.what() << ENDL; onShutDown(); return 0; } } } return data->length * 4; }
void SystemControllerMsgProxy::OnRequest(iviLink::Ipc::MsgID id, UInt8 const* pPayload, UInt32 payloadSize, UInt8* const pResponseBuffer, UInt32& bufferSize, iviLink::Ipc::DirectionID) { Message const* req = reinterpret_cast<Message const*>(pPayload); assert(req->header.size + sizeof(Message) == payloadSize); assert(bufferSize >= sizeof(Message)); switch (req->header.type) { case SC_CS_SHUTDOWN: onShutDown(); break; default: break; } }
void SystemControllerMsgProxy::OnRequest(iviLink::Ipc::MsgID id, UInt8 const* pPayload, UInt32 payloadSize, UInt8* const pResponseBuffer, UInt32& bufferSize, iviLink::Ipc::DirectionID) { Message const* req = reinterpret_cast<Message const*>(pPayload); assert(req->header.size + sizeof(Message) == payloadSize); assert(bufferSize >= sizeof(Message)); Message* resp = reinterpret_cast<Message*>(pResponseBuffer); switch (req->header.type) { case SC_PM_SHUTDOWN: { onShutDown(); bufferSize = 0; } break; case SC_PM_UNLOCK_PROFILES: { bool wasError = !onUnlockProfiles().isNoError(); writeBoolToMessage(resp, wasError, bufferSize); } break; case SC_PM_UNLOCK_AUTHENTICATION_PROFILE: { bool wasError = !onUnlockAuthenticationProfile().isNoError(); writeBoolToMessage(resp, wasError, bufferSize); } break; case SC_PM_AUTHENTICATION_DONE: { onAuthenticationDone(); bufferSize = 0; } break; default: assert(false); break; } }