本文整理汇总了C++中schedule_event函数的典型用法代码示例。如果您正苦于以下问题:C++ schedule_event函数的具体用法?C++ schedule_event怎么用?C++ schedule_event使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了schedule_event函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ADDECON
/*** Add a server when their shift starts. ***/
void
ADDECON()
{
int _edge_condition[2];
/* state changes */
ECONGS=ECONGS+1;
SERVER[0]=SERVER[0]+1;
/* Evaluate edge conditions now so that they will*/
/* not be changed by preemptive event execution */
_edge_condition[0] = ( ECONGS<ECONEX );
_edge_condition[1] = ( QUEUE[0]>0 );
/* schedule future events */
if (_edge_condition[0])
{
for ( t_index=3; t_index<maxatr; t_index++) transfer[t_index] = 0.0;
event_time = current_time + 0;
event_type = ADDECON_event;
event_priority = 5;
schedule_event();
}
if (_edge_condition[1])
{
for ( t_index=3; t_index<maxatr; t_index++) transfer[t_index] = 0.0;
event_time = current_time + 0;
event_type = STEE_event;
event_priority = 5;
schedule_event();
}
}
示例2: ASSIGN
/*** A first class server chooses to help a first class or economy passengers. ***/
void
ASSIGN()
{
int _edge_condition[2];
/* state changes */
DECSERV=0;
/* Evaluate edge conditions now so that they will*/
/* not be changed by preemptive event execution */
_edge_condition[0] = ( QUEUE[0]>0&&QUEUE[1]==0&&SERVER[0]==0&&SERVER[1]>0 );
_edge_condition[1] = ( QUEUE[1]>0 );
/* schedule future events */
if (_edge_condition[0])
{
for ( t_index=3; t_index<maxatr; t_index++) transfer[t_index] = 0.0;
event_time = current_time + 0;
event_type = STFCE_event;
event_priority = 5;
schedule_event();
}
if (_edge_condition[1])
{
for ( t_index=3; t_index<maxatr; t_index++) transfer[t_index] = 0.0;
event_time = current_time + 0;
event_type = STFCFC_event;
event_priority = 5;
schedule_event();
}
}
示例3: create_burst
static void create_burst(xProcess_PCB_ptr process)
{
time_t burst_length;
time_t io_service_time;
char buffer[BUFFER_SIZE];
/* Determine the length of the CPU burst */
burst_length = gaussian_random(CPU_BURST_MEDIAN, CPU_BURST_SIGMA);
/*
* Determine the manner in which the quantum will end. The idle
* process always runs to the end of its quantum
*/
if (xSimulator_time() + burst_length > timer_time) { /* CPU Burst */
/* Determine if the process will end on this CPU burst */
if (0 == (rand() % END_PROCESS_PROBABILITY)) {
burst_length = rand() % (timer_time - xSimulator_time());
process_end_time = xSimulator_time() + burst_length;
process_end_event = schedule_event(process_end_time, xSystem_process_end, NULL);
} else {
/* Just allow the timer to handle everything */
}
} else { /* The slice ends with blocking I/O */
io_start_time = xSimulator_time() + burst_length;
io_service_time = gaussian_random(IO_BURST_MEDIAN, IO_BURST_SIGMA);
io_end_time = io_start_time + io_service_time;
io_start_event = schedule_event(io_start_time, xSystem_io_start, NULL);
io_end_event = schedule_event(io_end_time, xSystem_io_end, process);
snprintf(buffer, BUFFER_SIZE, "Scheduled I/O burst to end at %08ld.", io_end_time);
print(process, buffer);
}
}
示例4: modem_fill
static inline void
modem_fill(struct BCState *bcs) {
if (bcs->tx_skb) {
if (bcs->tx_skb->len) {
write_modem(bcs);
return;
} else {
if (test_bit(FLG_LLI_L1WAKEUP,&bcs->st->lli.flag) &&
(PACKET_NOACK != bcs->tx_skb->pkt_type)) {
u_long flags;
spin_lock_irqsave(&bcs->aclock, flags);
bcs->ackcnt += bcs->hw.hscx.count;
spin_unlock_irqrestore(&bcs->aclock, flags);
schedule_event(bcs, B_ACKPENDING);
}
dev_kfree_skb_any(bcs->tx_skb);
bcs->tx_skb = NULL;
}
}
if ((bcs->tx_skb = skb_dequeue(&bcs->squeue))) {
bcs->hw.hscx.count = 0;
test_and_set_bit(BC_FLG_BUSY, &bcs->Flag);
write_modem(bcs);
} else {
test_and_clear_bit(BC_FLG_BUSY, &bcs->Flag);
schedule_event(bcs, B_XMTBUFREADY);
}
}
示例5: ADDFC
/*** Add a first class server when their shift starts ***/
void
ADDFC()
{
int _edge_condition[2];
/* state changes */
FCGS=FCGS+1;
SERVER[1]=SERVER[1]+1;
/* Evaluate edge conditions now so that they will*/
/* not be changed by preemptive event execution */
_edge_condition[0] = ( 1==1 );
_edge_condition[1] = ( FCGS<FCEX );
/* schedule future events */
if (_edge_condition[0])
{
for ( t_index=3; t_index<maxatr; t_index++) transfer[t_index] = 0.0;
event_time = current_time + 0;
event_type = ASSIGN_event;
event_priority = 5;
schedule_event();
}
if (_edge_condition[1])
{
for ( t_index=3; t_index<maxatr; t_index++) transfer[t_index] = 0.0;
event_time = current_time + 0;
event_type = ADDFC_event;
event_priority = 5;
schedule_event();
}
}
示例6: CUSTM
/*** ARRIVAL OF ANY CUSTOMER, where M is uniform rv[01] ***/
void
CUSTM()
{
int _edge_condition[3];
/* Attribute Value(s) Passed to this Event */
J = (long) transfer[3];
/* state changes */
C[J]=C[J]+1;
M=RND;
/* Evaluate edge conditions now so that they will*/
/* not be changed by preemptive event execution */
_edge_condition[0] = ( 1==1 );
_edge_condition[1] = ( M>R&&S[J]>0 );
_edge_condition[2] = ( M<=R );
/* schedule future events */
if (_edge_condition[0])
/*** SCHEDULE THE NEXT ARRIVAL ( arrive according to some distribution specified by the customer type) ***/
{
/*** attribute value(s) to be transferred to event ***/
transfer[3] = J;
for ( t_index=4; t_index<maxatr; t_index++) transfer[t_index] = 0.0;
event_time = current_time + 3+ARRMM[J][1]*BET(2,2);
event_type = CUSTM_event;
event_priority = 6;
schedule_event();
}
if (_edge_condition[1])
/*** THE CUSTOMER BELONGS TO WALKIN ***/
{
/*** attribute value(s) to be transferred to event ***/
transfer[3] = J;
transfer[4] = M>R;
for ( t_index=5; t_index<maxatr; t_index++) transfer[t_index] = 0.0;
event_time = current_time + 0;
event_type = WALKIN_event;
event_priority = 5;
schedule_event();
}
if (_edge_condition[2])
/*** Delay needs to be determined by something that depends on the customer type. CAR IS SUPPOSED TO BE RESERVED ***/
{
/*** attribute value(s) to be transferred to event ***/
transfer[3] = J;
transfer[4] = M>R;
for ( t_index=5; t_index<maxatr; t_index++) transfer[t_index] = 0.0;
event_time = current_time + 1+RES*BET(1.2,1.2)-1;
event_type = RESERV_event;
event_priority = 3;
schedule_event();
}
}
示例7: INPUT
/*** Generate input ( 4 types of cars) ***/
void
INPUT()
{
int _edge_condition[3];
/* Attribute Value(s) Passed to this Event */
J = (long) transfer[3];
K = (long) transfer[4];
/* state changes */
ENT[1]=J;
ENT[0]=K;
RNK[J]=0;
K=K+0*PUT(INC,J);
/* Evaluate edge conditions now so that they will*/
/* not be changed by preemptive event execution */
_edge_condition[0] = ( J<=4&&K<S[J]-1 );
_edge_condition[1] = ( J<4&&K>=S[J]-1 );
_edge_condition[2] = ( K>=S[J]-1 );
/* schedule future events */
if (_edge_condition[0])
{
/*** attribute value(s) to be transferred to event ***/
transfer[3] = J;
transfer[4] = K+1;
for ( t_index=5; t_index<maxatr; t_index++) transfer[t_index] = 0.0;
event_time = current_time + 0;
event_type = INPUT_event;
event_priority = 5;
schedule_event();
}
if (_edge_condition[1])
{
/*** attribute value(s) to be transferred to event ***/
transfer[3] = J+1;
transfer[4] = 0;
for ( t_index=5; t_index<maxatr; t_index++) transfer[t_index] = 0.0;
event_time = current_time + 0;
event_type = INPUT_event;
event_priority = 5;
schedule_event();
}
if (_edge_condition[2])
{
/*** attribute value(s) to be transferred to event ***/
transfer[3] = J;
for ( t_index=4; t_index<maxatr; t_index++) transfer[t_index] = 0.0;
event_time = current_time + 0;
event_type = costs_event;
event_priority = 5;
schedule_event();
}
}
示例8: fsv_set_mode
/* Switches between visualization modes */
void
fsv_set_mode( FsvMode mode )
{
boolean first_init = FALSE;
switch (globals.fsv_mode) {
case FSV_SPLASH:
/* Queue desired mode */
initial_fsv_mode = mode;
return;
case FSV_NONE:
/* Filesystem's first appearance */
first_init = TRUE;
break;
default:
/* Set initial mode for next time */
initial_fsv_mode = mode;
break;
}
/* Generate appropriate visualization geometry */
geometry_init( mode );
/* Set up initial camera state */
camera_init( mode, first_init );
globals.fsv_mode = mode;
/* Ensure that About presentation is not up */
about( ABOUT_END );
/* Render one frame before performing the initial camera pan.
* There are two separate reasons for doing this: */
if (first_init) {
/* 1. Practical limitations make the first frame take an
* unusually long time to render, so this avoids a really
* unpleasant camera jump */
schedule_event( initial_camera_pan, "new_fs", 1 );
}
else {
/* 2. In order to do a camera pan, the geometry needs to
* be defined. We just called geometry_init( ), but if the
* camera's going to a non-root node, it may very well not
* have been laid out yet (but it will be when drawn) */
schedule_event( initial_camera_pan, "", 1 );
}
}
示例9: SETSRVR
/*** Set the number of expected economy servers in the system at the beginning of a shift. ***/
void
SETSRVR()
{
int _edge_condition[3];
/* state changes */
ECONEX=ECONES[TIMEIDX];
FCEX=FCES[TIMEIDX];
TIMEIDX=TIMEIDX+1;
/* Evaluate edge conditions now so that they will*/
/* not be changed by preemptive event execution */
_edge_condition[0] = ( TIMEIDX<6 );
_edge_condition[1] = ( ECONGS<ECONEX );
_edge_condition[2] = ( FCGS<FCEX );
/* schedule future events */
if (_edge_condition[0])
/*** Every four hours, update the number of servers in the system. ***/
{
for ( t_index=3; t_index<maxatr; t_index++) transfer[t_index] = 0.0;
event_time = current_time + 240;
event_type = SETSRVR_event;
event_priority = 5;
schedule_event();
}
if (_edge_condition[1])
/*** Add extra servers to economy staff if needed ***/
{
for ( t_index=3; t_index<maxatr; t_index++) transfer[t_index] = 0.0;
event_time = current_time + 0;
event_type = ADDECON_event;
event_priority = 5;
schedule_event();
}
if (_edge_condition[2])
{
for ( t_index=3; t_index<maxatr; t_index++) transfer[t_index] = 0.0;
event_time = current_time + 0;
event_type = ADDFC_event;
event_priority = 5;
schedule_event();
}
}
示例10: nodemenu_select
static int nodemenu_select(ClientData data, Tcl_Interp *interp,
int argc, char *argv[])
{
extern void unschedule_node(int node);
int n, s;
if(vflag) {
for(n=0 ; n<argc-1 ; ++n)
fprintf(stderr,"%s ", argv[n]);
fprintf(stderr,"%s\n", argv[argc-1]);
}
if(argc != 3) {
interp->result = "wrong # args";
return TCL_ERROR;
}
n = atoi(argv[1]);
s = atoi(argv[2]);
if(n < 0 || n >= _NNODES || s < 0 || s >= N_NODEMENU_STRINGS) {
interp->result = "invalid node or menu arg";
return TCL_ERROR;
}
switch (s) {
case RE : NP[n].runstate = STATE_REBOOTING;
schedule_event(EV_REBOOT, n, int64_ONE, NULLTIMER,
NP[n].data[(int)EV_REBOOT]);
break;
case CR : NP[n].runstate = STATE_CRASHED;
unschedule_node(n);
break;
case SR : NP[n].runstate = STATE_AUTOREBOOT;
schedule_event(EV_REBOOT, n, int64_ONE, NULLTIMER,
NP[n].data[(int)EV_REBOOT]);
break;
case P1 :
case P6 : NP[n].runstate = STATE_PAUSED;
int64_I2L(NP[n].will_resume, (s == P1 ? 10000000 : 60000000));
schedule_event(EV_REBOOT, n, NP[n].will_resume, NULLTIMER,
NP[n].data[(int)EV_REBOOT]);
int64_ADD(NP[n].will_resume, TIMENOW_in_USEC,NP[n].will_resume);
break;
}
draw_node_icon(FALSE,n);
if(dflag)
fprintf(stderr,"%s.menu -> %s\n", NP[n].nodename, menu_strings[s]);
return TCL_OK;
}
示例11: STEE
/*** Economy servers start service for economy passengers ***/
void
STEE()
{
int _edge_condition[2];
/* state changes */
QUEUE[0]=QUEUE[0]-GET(FST,0);
SERVER[0]=SERVER[0]-1;
DEPTIME=ENT[4];
DECSERV=0;
/* Evaluate edge conditions now so that they will*/
/* not be changed by preemptive event execution */
_edge_condition[0] = ( 1==1 );
/* schedule future events */
if (_edge_condition[0])
{
/*** attribute value(s) to be transferred to event ***/
transfer[3] = DEPTIME;
for ( t_index=4; t_index<maxatr; t_index++) transfer[t_index] = 0.0;
event_time = current_time + ECONBASE+ECONBAG*RND*ENT[2]+ECONTIX*RND*ENT[3];
event_type = FINEE_event;
event_priority = 5;
schedule_event();
}
}
示例12: FINEE
/*** Economy servers finish service for economy passengers ***/
void
FINEE()
{
int _edge_condition[2];
/* Attribute Value(s) Passed to this Event */
DEPTIME = (long) transfer[3];
/* state changes */
SERVER[0]=SERVER[0]+(ECONGS<=ECONEX);
MISSFL=MISSFL+(CLK>(DEPTIME-30));
DECSERV=(ECONGS>ECONEX);
ECONGS=ECONGS-(ECONGS>ECONEX);
/* Evaluate edge conditions now so that they will*/
/* not be changed by preemptive event execution */
_edge_condition[0] = ( QUEUE[0]>0&&DECSERV==0 );
/* schedule future events */
if (_edge_condition[0])
{
for ( t_index=3; t_index<maxatr; t_index++) transfer[t_index] = 0.0;
event_time = current_time + 0;
event_type = STEE_event;
event_priority = 5;
schedule_event();
}
}
示例13: serial_store
static
int
serial_store(unsigned cpunum, void *d, uint32_t offset, uint32_t val)
{
struct ser_data *sd = d;
(void)cpunum;
switch (offset) {
case SERREG_CHAR:
if (!sd->sd_wbusy) {
sd->sd_wbusy = 1;
g_stats.s_wchars++;
console_putc(val);
schedule_event(SERIAL_NSECS, sd, 0,
serial_writedone, "serial write");
}
return 0;
case SERREG_RIRQ:
storeirq(&sd->sd_rirq, val);
setirq(sd);
return 0;
case SERREG_WIRQ:
storeirq(&sd->sd_wirq, val);
setirq(sd);
return 0;
}
return -1;
}
示例14: FINFCFC
/*** First class servers finish service for economy passengers ***/
void
FINFCFC()
{
int _edge_condition[1];
/* Attribute Value(s) Passed to this Event */
DEPTIME = (long) transfer[3];
/* state changes */
SERVER[1]=SERVER[1]+(FCGS<=FCEX);
MISSFLFC=MISSFLFC+(CLK>(DEPTIME-30));
DECSERV=(FCGS>FCEX);
FCGS=FCGS-(FCGS>FCEX);
/* Evaluate edge conditions now so that they will*/
/* not be changed by preemptive event execution */
_edge_condition[0] = ( DECSERV==0 );
/* schedule future events */
if (_edge_condition[0])
{
for ( t_index=3; t_index<maxatr; t_index++) transfer[t_index] = 0.0;
event_time = current_time + 0;
event_type = ASSIGN_event;
event_priority = 5;
schedule_event();
}
}
示例15: setctl
static
void
setctl(struct net_data *nd, u_int32_t val)
{
if ((val & NDC_ZERO) != 0) {
hang("Illegal network control register write");
}
else {
if (val & NDC_START) {
if (nd->nd_control & NDC_START) {
hang("Network packet send started while "
"send already in progress");
}
else {
schedule_event(NETWORK_LATENCY,
nd, 0,
triggersend,
"packet send");
}
}
else if (nd->nd_control & NDC_START) {
/* cannot turn it off explicitly */
val |= NDC_START;
}
nd->nd_control = val;
}
}