C++ create_event函数代码示例

本文整理汇总了C++中create_event函数的典型用法代码示例。如果您正苦于以下问题:C++ create_event函数的具体用法?C++ create_event怎么用?C++ create_event使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


C++ create_event函数代码示例

在下文中一共展示了create_event函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: add_prov_event

/**
 * @brief
 * 		adds event(s) for bringing the node back up after we provision a node
 *
 * @param[in] calnedar 		- event list to add event(s) to
 * @param[in] event_time 	- time of the event
 * @param[in] node 			- node in question
 *
 * @return	success/failure
 * @retval 	1 : on sucess
 * @retval 	0 : in failure/error
 */
int
add_prov_event(event_list *calendar, time_t event_time, node_info *node)
{
	timed_event *te;

	if (calendar == NULL || node == NULL)
		return 0;

	te = create_event(TIMED_NODE_UP_EVENT, event_time, (event_ptr_t *) node,
		(event_func_t) node_up_event, NULL);
	if (te == NULL)
		return 0;
	add_event(calendar, te);
	/* if the node is resv node, we need to add an event to bring the
	 * server version of the resv node back up
	 */
	if (node->svr_node != NULL) {
		te = create_event(TIMED_NODE_UP_EVENT, event_time,
			(event_ptr_t *) node->svr_node, (event_func_t) node_up_event, NULL);
		if (te == NULL)
			return 0;
		add_event(calendar, te);
	}
	return 1;
}
开发者ID:altair4,项目名称:pbspro,代码行数:37,代码来源:simulate.c

示例2: add_dedtime_events

/**
 * @brief
 * 		add the dedicated time events from conf
 *
 * @param[in] elist 	- the event list to add the dedicated time events to
 * @param[in] policy 	- status structure for the dedicated time events
 *
 *	@retval 1 : success
 *	@retval 0 : failure
 */
int
add_dedtime_events(event_list *elist, status *policy)
{
	int i;
	timed_event *te_start;
	timed_event *te_end;

	if (elist == NULL)
		return 0;


	for (i = 0; i < MAX_DEDTIME_SIZE && conf.ded_time[i].from != 0; i++) {
		te_start = create_event(TIMED_DED_START_EVENT, conf.ded_time[i].from, policy, (event_func_t) dedtime_change, (void *) DEDTIME_START);
		if (te_start == NULL)
			return 0;

		te_end = create_event(TIMED_DED_END_EVENT, conf.ded_time[i].to, policy, (event_func_t) dedtime_change, (void *) DEDTIME_END);
		if (te_end == NULL) {
			free_timed_event(te_start);
			return 0;
		}

		add_event(elist, te_start);
		add_event(elist, te_end);
	}
	return 1;
}
开发者ID:altair4,项目名称:pbspro,代码行数:37,代码来源:simulate.c

示例3: analyze_data

int analyze_data(struct ftdi2s88_t *fs88, uint8_t * b, int s88_bits) {
    int ret, i, k;
    uint32_t c;

    k = 0;
    bzero(bus0_actual, sizeof(bus0_actual));
    bzero(bus1_actual, sizeof(bus1_actual));

    if (b[8] & S88_DATA_I) {
	bus0_actual[0] = 1;
    }
    if (b[8] & S88_DATA_II)
	bus1_actual[0] = 1;

    for (i = 1; i < s88_bits; i++) {
	if ((i & 0x1f) == 0)
	    k++;
	bus0_actual[k] <<= 1;
	bus1_actual[k] <<= 1;
	if (b[14 + i * 4] & S88_DATA_I)
	    bus0_actual[k] |= 1;
	if (b[14 + i * 4] & S88_DATA_II)
	    bus1_actual[k] |= 1;
    }
    /* align left */
    if (i & 0x1f) {
	bus0_actual[k] <<= (32 - (s88_bits & 0x1f));
	bus1_actual[k] <<= (32 - (s88_bits & 0x1f));
    }

    if (!fs88->background)
	printf("bus0_actual[0]: 0x%08X bus1_actual[0]: 0x%08X\n", bus0_actual[0], bus1_actual[0]);

    /* debouncing - tricky part */
    for (i = 0; i <= 0; i++) {
	c = bus0_state[i] ^ ~bus0_actual[i];
	bus0_ct0[i] = ~(bus0_ct0[i] & c);
	bus0_ct1[i] = bus0_ct0[i] ^ (bus0_ct1[i] & c);
	/* 2 bit roll over */
	c &= bus0_ct0[i] & bus0_ct1[i];
	bus0_state[i] ^= c;
	ret = create_event(fs88, 0, i * 32, c, bus0_actual[i]);
	if (ret)
	    return -1;

	c = bus1_state[i] ^ ~bus1_actual[i];
	bus1_ct0[i] = ~(bus1_ct0[i] & c);
	bus1_ct1[i] = bus1_ct0[i] ^ (bus1_ct1[i] & c);
	/* 2 bit roll over */
	c &= bus1_ct0[i] & bus1_ct1[i];
	bus1_state[i] ^= c;
	ret = create_event(fs88, 0, 256 + i * 32, c, bus1_actual[i]);
	if (ret)
	    return -1;
    }
    return 0;
}
开发者ID:GBert,项目名称:railroad,代码行数:57,代码来源:ftdi2s88.c

示例4: create_events

/**
 * @brief
 *		create_events - creates an timed_event list from running jobs
 *			    and confirmed reservations
 *
 * @param[in] sinfo - server universe to act upon
 *
 * @return	timed_event list
 *
 */
timed_event *
create_events(server_info *sinfo)
{
	timed_event	*events = NULL;
	timed_event	*te = NULL;
	resource_resv	**all = NULL;
	int		errflag = 0;
	int		i = 0;
	time_t 		end = 0;

	/* all_resresv is sorted such that the timed events are in the front of
	 * the array.  Once the first non-timed event is reached, we're done
	 */
	all = sinfo->all_resresv;

	/* sort the all resersv list so all the timed events are in the front */
	qsort(all, count_array((void **)all), sizeof(resource_resv *), cmp_events);

	for (i = 0; all[i] != NULL && is_timed(all[i]); i++) {
		if (all[i]->is_resv && all[i]->resv &&
			all[i]->resv->resv_state == RESV_BEING_ALTERED)
			continue;
		/* only add a run event for a job or reservation if they're
		 * in a runnable state (i.e. don't add it if they're running)
		 */
		if (in_runnable_state(all[i])) {
			te = create_event(TIMED_RUN_EVENT, all[i]->start, all[i], NULL, NULL);
			if (te == NULL) {
				errflag++;
				break;
			}
			events = add_timed_event(events, te);
		}

		if (sinfo->use_hard_duration)
			end = all[i]->start + all[i]->hard_duration;
		else
			end = all[i]->end;
		te = create_event(TIMED_END_EVENT, end, all[i], NULL, NULL);
		if (te == NULL) {
			errflag++;
			break;
		}
		events = add_timed_event(events, te);
	}

	/* A malloc error was encountered, free all allocated memory and return */
	if (errflag > 0) {
		free_timed_event_list(events);
		return 0;
	}

	return events;
}
开发者ID:altair4,项目名称:pbspro,代码行数:64,代码来源:simulate.c

示例5: callback

Console::Console (
    std::function<void (String)> callback,
    Nullable<Word> output_max,
    std::function<void (std::exception_ptr)> panic
) : callback(std::move(callback)), output_max(std::move(output_max)), barrier(2), panic(std::move(panic)) {

    //	Prepare events
    queued=create_event();

    try {

        stop=create_event();

        try {

            //	Start worker
            t=Thread([this] () mutable {	worker_func();	});

            //	Wait for worker thread
            //	to start
            barrier.Enter();

            //	Did startup fail?
            if (except) {

                //	YES, join worker and
                //	throw

                t.Join();

                std::rethrow_exception(except);

            }

        } catch (...) {

            CloseHandle(stop);

            throw;

        }

    } catch (...) {

        CloseHandle(queued);

        throw;

    }

}
开发者ID:andrewphorn,项目名称:MCPP,代码行数:51,代码来源:console.cpp

示例6: sync_CondInit

pwr_tStatus
sync_CondInit (
  thread_sCond	*cp
)
{

#if defined OS_ELN

  pwr_tStatus sts;

  ker$create_event(&sts, cp, EVENT$CLEARED);

  return sts;

#elif defined OS_LYNX && defined PWR_LYNX_30

  return errno_Pstatus(pthread_cond_init(&cp->c, NULL));

#elif defined OS_POSIX

  return errno_Status(pthread_cond_init(&cp->c, NULL));

#elif defined OS_VMS

  return errno_Status(tis_cond_init(&cp->c));

#else
# error Not defined for this platform !
#endif
}
开发者ID:jordibrus,项目名称:proview,代码行数:30,代码来源:rt_sync.c

示例7: fire_event

void fire_event(HTMLDocumentNode *doc, eventid_t eid, BOOL set_event, nsIDOMNode *target, nsIDOMEvent *nsevent,
        IDispatch *script_this)
{
    HTMLEventObj *event_obj = NULL;
    HTMLDOMNode *node;
    HRESULT hres;

    if(set_event) {
        hres = get_node(doc, target, TRUE, &node);
        if(FAILED(hres))
            return;

        event_obj = create_event();
        node_release(node);
        if(!event_obj)
            return;

        hres = set_event_info(event_obj, node, eid, nsevent);
        if(FAILED(hres)) {
            IHTMLEventObj_Release(&event_obj->IHTMLEventObj_iface);
            return;
        }
    }

    fire_event_obj(doc, eid, event_obj, target, script_this);

    if(event_obj)
        IHTMLEventObj_Release(&event_obj->IHTMLEventObj_iface);
}
开发者ID:PigFlyGames,项目名称:wine,代码行数:29,代码来源:htmlevent.c

示例8: Lucent_handle_dle

static int Lucent_handle_dle(char data)
     {

     switch (data)
          {

	  /*
	   * It appears that Lucent modems have just a single
	   * silence detection notification, that always reports
	   * as "<DLE>-s".  This report indicates that silence
	   * exceeding the duration of the interval set with AT+VSD
	   * has been detected, regardless of whether there was
	   * previously good data or not.
	   *
	   * So here we override the IS_101 mapping of DLE-s to
	   * "NO_VOICE_ENERGY", and change it to "SILENCE_DETECTED".
	   *
	   * Caveat: this will break vgetty's heuristic "if <DLE>s
	   *  was seen, there is nobody at the calling end, so let's try
	   *  data/fax mode".  So if you have a Lucent modem and want to
	   *  do voice and data/fax on the same line, you need calling
	   *  modems that send a CNG tone, or have the caller dial up,
	   *  wait for a few seconds, and then send another DTMF tone
	   *  (which will trigger data/fax mode).
	   *
	   * Patch by Paul Fox <[email protected]>
	   */
          case 's':
               return(queue_event(create_event(SILENCE_DETECTED)));

          }

     return(IS_101_handle_dle(data));
     }
开发者ID:OPSF,项目名称:uClinux,代码行数:34,代码来源:Lucent.c

示例9: send

void zPacketHTTP::send(const string& hdr) const
{
 pos=0;
 if(hdr.size()) str_out.insert(0, hdr);
 if(create_event(parent->ev_base, EV_TIMEOUT | EV_WRITE | EV_PERSIST, (zPacketHTTP*) this, WRITE_TIMEOUT_SEC, WRITE_TIMEOUT_MSEC) == NULL)
 { push(); zLog::Log.write("error_zPacketHTTP::send\n"); /*cout << "error_zPacketHTTP::send" << endl;*/ }
};
开发者ID:jtalz,项目名称:znetlib,代码行数:7,代码来源:z_packet.cpp

示例10: send_text

void zPacketHTTP::send_text(const string& hdr, const string& connection) const
{
 pos=0;
 str_out.insert(0, "HTTP/1.1 200 OK\r\nCONTENT-TYPE:"+hdr+"\r\nContent-Length:"+ZNSTR::toString(str_out.size())+"\r\nConnection:"+connection+"\r\n\r\n");
 if(create_event(parent->ev_base, EV_TIMEOUT | EV_WRITE | EV_PERSIST, (zPacketHTTP*) this, WRITE_TIMEOUT_SEC, WRITE_TIMEOUT_MSEC) == NULL)
 { push(); zLog::Log.write("error_zPacketHTTP::send_text\n"); /*cout << "error_zPacketHTTP::send_text" << endl;*/ }
};
开发者ID:jtalz,项目名称:znetlib,代码行数:7,代码来源:z_packet.cpp

示例11: send_location

void zPacketHTTP::send_location(const string& path, const string& connection) const
{
 pos=0;
 str_out="HTTP/1.1 303 Redirection\r\nLOCATION:http://"+path+"\r\nContent-Length:0\r\nConnection:"+connection+"\r\n\r\n";
 if(create_event(parent->ev_base, EV_TIMEOUT | EV_WRITE | EV_PERSIST, (zPacketHTTP*) this, WRITE_TIMEOUT_SEC, WRITE_TIMEOUT_MSEC) == NULL)
 { push(); zLog::Log.write("error_zPacketHTTP::send_location\n"); /*cout << "error_zPacketHTTP::send_location" << endl;*/ }
};
开发者ID:jtalz,项目名称:znetlib,代码行数:7,代码来源:z_packet.cpp

示例12: send_empty

void zPacketHTTP::send_empty(const string& connection) const
{
 pos=0;
 str_out="HTTP/1.1 204 No Content\r\nContent-Type:text/html\r\nContent-Length:0\r\nConnection:"+connection+"\r\n\r\n";
 if(create_event(parent->ev_base, EV_TIMEOUT | EV_WRITE | EV_PERSIST, (zPacketHTTP*) this, WRITE_TIMEOUT_SEC, WRITE_TIMEOUT_MSEC) == NULL)
 { push(); zLog::Log.write("error_zPacketHTTP::send_empty\n"); /*cout << "error_zPacketHTTP::send_empty" << endl;*/ }
};
开发者ID:jtalz,项目名称:znetlib,代码行数:7,代码来源:z_packet.cpp

示例13: main

int main(int argc, char const *argv[])
{
    char err[SOCKET_ERR_LEN];

    pool = buffer_pool_create(100);
    prev_recv = prev_send = 0;
    recv_total = send_total = 0;

    int sfd = tcp_server_serve(err, "localhost", 3456, SOMAXCONN);
    if (sfd < 0) {
        printf("%d %s\n", sfd, err);
        return 0;
    }

    if (set_nonblock(err, sfd) != 0) {
        printf("%s\n", err);
        return 0;
    }

    if (set_tcp_nodelay(err, sfd, 1) != 0) {
        printf("%s\n", err);
        return 0;
    }

    event_loop_t *loop = event_loop_create(100, 10);
    assert(loop != NULL);

    create_timer(loop, 1000, print_info, NULL);
    create_event(loop, sfd, EV_RDABLE, server_accept_cb, NULL);

    event_loop_start(loop);
}
开发者ID:SerhoLiu,项目名称:libakio,代码行数:32,代码来源:demo.c

示例14: initServer

void initServer(char *host, int port) {
	char *msg;
	int listendfd = anetTcpServer(msg, port, host);
	if (listendfd <= 0) {
		lookup_log(LOG_DEBUG, "create server error %s\n", msg);
		exit(0);
	}
	lookup_log(LOG_DEBUG, "listened %s:%d\n", host, port);
	if (anetNonBlock(msg, listendfd) < 0) {
		lookup_log(LOG_DEBUG, "set noblocking server error %s\n", msg);
		exit(0);		
	}
	pool = create_event(1024);
	add_event(pool, listendfd, EPOLLIN, serverAccept);
	while (1) {
		lookup_log(LOG_DEBUG, "polling\n");
		int num = handle_event(pool, 30);
		int i;
		for (i=0; i<num; i++) {
			int fd = pool->epollEv[i].data.fd;
			noti_chain_callback cb = pool->events[fd].cb;
			(*cb) (&pool->events[fd], fd);
		}
	}
	close(listendfd);
}
开发者ID:wudikua,项目名称:lookup,代码行数:26,代码来源:server.c

示例15: create_event

static void *create_timer(plcba_cbcio *cbcio)
{
    PLCBA_c_event *cevent = create_event(cbcio);
    cevent->evtype = PLCBA_EVTYPE_TIMER;
    //warn("Created timer %p", cevent);
    return cevent;
}
开发者ID:neomorphic,项目名称:perl-Couchbase-Client,代码行数:7,代码来源:async_events.c

本文标签属性:

示例:示例英文

代码:代码零九

上一篇:C# Aura类代码示例
下一篇:Java AdapterView.getPositionForView方法代码示例

为您推荐