本文整理汇总了C++中post_event函数的典型用法代码示例。如果您正苦于以下问题:C++ post_event函数的具体用法?C++ post_event怎么用?C++ post_event使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了post_event函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: process_post_priority_event
process_post_event_status
process_post_priority_event(process* p, process_event_t ev, process_data_t data,
process_event_priority pri)
{
if (pri >= NB_PROCESS_EVENT_PRIORITIES) {
return PROCESS_POST_EVENT_INVALID_PRIORITY;
}
return post_event(p, &queues[pri], ev, data);
}
示例2: load_url
static audio_result_t load_url(void* _mp3_info, const char* url)
{
mp3_t* mp3_info = (mp3_t*) _mp3_info;
mc_free(mp3_info->file_or_url);
mp3_info->file_or_url = mc_strdup(url);
post_event(mp3_info->player_control, INTERNAL_CMD_LOAD_URL, -1);
psem_wait(mp3_info->length_set);
return AUDIO_OK;
}
示例3: load_file
static audio_result_t load_file(void* _minfo, const char* file)
{
ogg_t* minfo = (ogg_t*) _minfo;
mc_free(minfo->file_or_url);
minfo->file_or_url = mc_strdup(file);
post_event(minfo->player_control, INTERNAL_CMD_LOAD_FILE, -1);
psem_wait(minfo->length_set);
return AUDIO_OK;
}
示例4: TraceLogger
boost::statechart::result QuittingGame::react(const StartQuittingGame& u) {
TraceLogger(FSM) << "(HumanClientFSM) QuittingGame";
m_server_process = &u.m_server;
m_after_server_shutdown_action = u.m_after_server_shutdown_action;
post_event(ShutdownServer());
return discard_event();
}
示例5: my_base
Approaching::Approaching(my_context ctx) : my_base(ctx)
{
UISubState uiSubState = PRINTENGINE->PauseRequested() ? AboutToPause :
NoUISubState;
PRINTENGINE->SendStatus(ApproachingState, Entering, uiSubState);
if (context<PrinterStateMachine>()._motionCompleted)
post_event(EvMotionCompleted());
}
示例6: channel_server_connected
static void channel_server_connected(Channel * c1) {
trace(LOG_ALWAYS, "channel server connected");
assert(c1->state == ChannelStateConnected);
/* Connect to destination on next dispatch since we are limited in
* what we can do in a callback, e.g. cannot close channel. */
post_event(connect_dest, c1);
}
示例7: connect_event_handler
void facade::init(std::vector<std::string> args)
{
base::app::app::init(args);
///////////////////////////////////////////////////
base::event::event* new_event=NULL;
///////////////////////////////////////////////////
connect_event_handler("event.base.app.shutdown",
boost::bind(&base::app::app::handle_shutdown, this, _1));
///////////////////////////////////////////////////
std::string config_file("config/bj.client.dev.ini");
try
{
boost::property_tree::ini_parser::read_ini(config_file, *get_configuration("default"));
}
catch(const std::exception& e)
{
std::cerr<<"[facade::init] Exception: "<<e.what()<<"."<<std::endl;
std::cout<<"usage: "<<args[0]<<" [host_ip] [host_port]"<<std::endl;
///////////////////////////////////////////
new_event=base::event::Factory::get("event.base.app.shutdown");
new_event->set_debug_info(_DEBUG_INFO_());
post_event(new_event);
///////////////////////////////////////////
return;
}
//std::cout<<base::formatting::to_string(_options)<<std::endl;
merge_configuration_options("default");
//std::cout<<base::ptree::str(*get_configuration("default"))<<std::endl;
///////////////////////////////////////////////////
// connect_event_handler("event.base.deadlinetimer.timeout", boost::bind(&facade::handle_timeout, this, _1));
///////////////////////////////////////////////////
_xml=new xml(this);
_cli=new cli(this);
_cli->init();
_server_settings=new server_settings();
///////////////////////////////////////////////////
_session=new session(this);
_session->init();
std::string host_ip=get_configuration("default")->get<std::string>("server.ip");
int port=get_configuration("default")->get<int>("common.tcp_port");
boost::asio::ip::tcp::endpoint* endpoint=
new boost::asio::ip::tcp::endpoint(boost::asio::ip::address::from_string(host_ip), port);
_session->connect(endpoint);
///////////////////////////////////////////////////
_player=new player(this);
_player->set_name(get_configuration("default")->get<std::string>("player.name"));
_player->set_nick(get_configuration("default")->get<std::string>("player.nick"));
_player->set_pass(get_configuration("default")->get<std::string>("player.pass"));
_player->set_skin_id(get_configuration("default")->get<int>("player.skin_id"));
///////////////////////////////////////////////////
_player_controller=new player_controller(this);
_player_controller->set_player(_player);
_player_controller->init();
///////////////////////////////////////////////////
get_thread_group()->add_thread(new boost::thread(boost::bind(&cli::poll_std_cin, _cli)));
}
示例8: signal_handler
static void signal_handler(int sig) {
if (is_dispatch_thread()) {
discovery_stop();
signal(sig, SIG_DFL);
raise(sig);
}
else {
post_event(shutdown_event, NULL);
}
}
示例9: ftdi_change
// respond to connection or disconnection of ftdi device.
// may be called from an interrupt
void ftdi_change(uhc_device_t* dev, u8 plug) {
print_dbg("\r\n changed FTDI connection status");
if(plug) {
e.eventType = kEventFtdiConnect;
} else {
e.eventType = kEventFtdiDisconnect;
}
// posting an event so the main loop can respond
post_event(&e);
}
示例10: Base
////////////////////////////////////////////////////////////
// PlayingTurn
////////////////////////////////////////////////////////////
PlayingTurn::PlayingTurn(my_context ctx) :
Base(ctx)
{
TraceLogger(FSM) << "(HumanClientFSM) PlayingTurn";
Client().Register(Client().GetClientUI().GetMapWnd());
Client().GetClientUI().GetMapWnd()->InitTurn();
Client().GetClientUI().GetMapWnd()->RegisterWindows(); // only useful at game start but InitTurn() takes a long time, don't want to display windows before content is ready. could go in WaitingForGameStart dtor but what if it is given e.g. an error reaction?
// TODO: reselect last fleet if stored in save game ui data?
Client().GetClientUI().GetMessageWnd()->HandleGameStatusUpdate(
boost::io::str(FlexibleFormat(UserString("TURN_BEGIN")) % CurrentTurn()) + "\n");
Client().GetClientUI().GetMessageWnd()->HandlePlayerStatusUpdate(Message::PLAYING_TURN, Client().PlayerID());
Client().GetClientUI().GetPlayerListWnd()->Refresh();
Client().GetClientUI().GetPlayerListWnd()->HandlePlayerStatusUpdate(Message::PLAYING_TURN, Client().PlayerID());
if (Client().GetApp()->GetClientType() != Networking::CLIENT_TYPE_HUMAN_OBSERVER)
Client().GetClientUI().GetMapWnd()->EnableOrderIssuing(true);
if (Client().GetApp()->GetClientType() == Networking::CLIENT_TYPE_HUMAN_OBSERVER) {
// observers can't do anything but wait for the next update, and need to
// be back in WaitingForTurnData, so posting TurnEnded here has the effect
// of keeping observers in the WaitingForTurnData state so they can receive
// updates from the server.
post_event(TurnEnded());
} else if (Client().GetApp()->GetClientType() == Networking::CLIENT_TYPE_HUMAN_PLAYER) {
if (Client().GetClientUI().GetMapWnd()->AutoEndTurnEnabled()) {
// if in-game-GUI auto turn advance enabled, set auto turn counter to 1
Client().InitAutoTurns(1);
}
// if no auto turns left, and supposed to quit then autosave
// which will lead to a quit when the save completes
if (Client().AutoTurnsLeft() <= 0 && GetOptionsDB().Get<bool>("auto-quit"))
Client().Autosave();
// if there are still auto turns left, advance the turn automatically,
// and decrease the auto turn counter
if (Client().AutoTurnsLeft() > 0) {
post_event(AdvanceTurn());
Client().DecAutoTurns();
}
}
}
示例11: np_trigger_message
static void np_trigger_message(InputBuf * ibuf) {
ChannelNP * c = ibuf2np(ibuf);
assert(is_dispatch_thread());
assert(c->ibuf.message_count > 0);
if (c->ibuf.handling_msg == HandleMsgIdle) {
post_event(handle_channel_msg, c);
c->ibuf.handling_msg = HandleMsgTriggered;
}
}
示例12: seek
static audio_result_t seek(void* _minfo, long position_in_ms)
{
ogg_t* minfo = (ogg_t*) _minfo;
if (minfo->can_seek) {
post_event(minfo->player_control, INTERNAL_CMD_SEEK, position_in_ms);
return AUDIO_OK;
} else {
return AUDIO_NOT_SUPPORTED;
}
}
示例13: virtual_stream_get_data
int virtual_stream_get_data(VirtualStream * stream, char * buf, size_t buf_size, size_t * data_size, int * eos) {
size_t len;
assert(stream->magic == STREAM_MAGIC);
len = (stream->buf_inp + stream->buf_len - stream->buf_out) % stream->buf_len;
if (len > buf_size) {
len = buf_size;
*eos = 0;
}
else {
*eos = stream->eos_inp;
}
*data_size = len;
if (*eos) stream->eos_out = 1;
if (stream->buf_out + len <= stream->buf_len) {
memcpy(buf, stream->buf + stream->buf_out, len);
}
else {
size_t x = stream->buf_len - stream->buf_out;
size_t y = len - x;
memcpy(buf, stream->buf + stream->buf_out, x);
memcpy(buf + x, stream->buf, y);
}
if (stream->access & VS_ENABLE_REMOTE_WRITE) {
LINK * l;
for (l = stream->clients.next; l != &stream->clients; l = l->next) {
StreamClient * client = stream2client(l);
if (!list_is_empty(&client->write_requests)) {
WriteRequest * r = client2write_request(client->write_requests.next);
size_t done = 0;
int error = 0;
if (virtual_stream_add_data(client->stream, r->data + r->offs,
r->size - r->offs, &done, r->eos) < 0) error = errno;
r->offs += done;
if (error || r->offs >= r->size) {
delete_write_request(r, error);
}
while (error && !list_is_empty(&client->write_requests)) {
r = client2write_request(client->write_requests.next);
delete_write_request(r, ERR_COMMAND_CANCELLED);
}
}
}
}
if ((stream->access & VS_ENABLE_REMOTE_READ) == 0 && len > 0) {
stream->buf_out = (stream->buf_out + len) % stream->buf_len;
assert(!*eos || stream->buf_out == stream->buf_inp);
if (!stream->space_available_posted) {
post_event(notify_space_available, stream);
stream->space_available_posted = 1;
}
}
return 0;
}
示例14: execOutput
static void execOutput(acalcoutRecord *pcalc)
{
long status;
/* Determine output data */
if (aCalcoutRecordDebug >= 10)
printf("acalcoutRecord(%s):execOutput:entry\n", pcalc->name);
/* Check to see what to do if INVALID */
if (pcalc->nsev < INVALID_ALARM) {
/* Output the value */
if (aCalcoutRecordDebug >= 10)
printf("acalcoutRecord(%s):execOutput:calling writeValue\n", pcalc->name);
status = writeValue(pcalc);
/* post event if output event != 0 */
if (pcalc->oevt > 0) post_event((int)pcalc->oevt);
} else {
switch (pcalc->ivoa) {
case menuIvoaContinue_normally:
/* write the new value */
status = writeValue(pcalc);
/* post event if output event != 0 */
if (pcalc->oevt > 0) post_event((int)pcalc->oevt);
break;
case menuIvoaDon_t_drive_outputs:
break;
case menuIvoaSet_output_to_IVOV:
pcalc->oval=pcalc->ivov;
status = writeValue(pcalc);
/* post event if output event != 0 */
if (pcalc->oevt > 0) post_event((int)pcalc->oevt);
break;
default:
status=-1;
recGblRecordError(S_db_badField,(void *)pcalc,
"acalcout:process Illegal IVOA field");
}
}
}
示例15: CtrlHandler
static BOOL CtrlHandler(DWORD ctrl) {
switch(ctrl) {
case CTRL_C_EVENT:
case CTRL_CLOSE_EVENT:
case CTRL_BREAK_EVENT:
case CTRL_SHUTDOWN_EVENT:
post_event(shutdown_event, NULL);
return TRUE;
}
return FALSE;
}