当前位置: 首页>>代码示例>>C++>>正文


C++ PROCESS_CURRENT函数代码示例

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


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

示例1: zmq_socket_init

void zmq_socket_init(zmq_socket_t *self, zmq_socket_type_t socket_type) {
    zmtp_channel_init(&self->channel, socket_type, PROCESS_CURRENT(), PROCESS_CURRENT());

    switch(socket_type) {
      case ZMQ_ROUTER:
        zmq_router_init(self);
        break;
      case ZMQ_DEALER:
        zmq_dealer_init(self);
        break;
      case ZMQ_PUB:
        zmq_pub_init(self);
        break;
      case ZMQ_SUB:
        zmq_sub_init(self);
        break;
      case ZMQ_PUSH:
        zmq_push_init(self);
        break;
      case ZMQ_PULL:
        zmq_pull_init(self);
        break;
      default:
        printf("ERROR: Socket type not supported yet\r\n");
    }
}
开发者ID:keent,项目名称:contiki-zmtp,代码行数:26,代码来源:zmq.c

示例2: add_timer

/*---------------------------------------------------------------------------*/
static void
add_timer(struct etimer *timer)
{
  struct etimer *t;

  etimer_request_poll();

  if(timer->p != PROCESS_NONE) {
    for(t = timerlist; t != NULL; t = t->next) {
      if(t == timer) {
	/* Timer already on list, bail out. */
        timer->p = PROCESS_CURRENT();
	update_time();
	return;
      }
    }
  }

  /* Timer not on list. */
  timer->p = PROCESS_CURRENT();
  timer->next = timerlist;
  timerlist = timer;

  update_time();
}
开发者ID:atiselsts,项目名称:contiki-optimized,代码行数:26,代码来源:etimer.c

示例3: add_timer

/*---------------------------------------------------------------------------*/
static void
add_timer(struct etimer *timer) {
    struct etimer *t;
    struct process *p;

    etimer_request_poll();

    if (timer->p != PROCESS_NONE) {
        for (t = timerlist; t != NULL; t = t->next) {
            if (t == timer) {
                /* Timer already on list, bail out. */
                p = PROCESS_CURRENT();
                memcpy(&(timer->p), &(p), sizeof (struct process*));
                update_time();
                return;
            }
        }
    }

    /* Timer not on list. */

    p = PROCESS_CURRENT();
    memcpy(&(timer->p), &(p), sizeof (struct process*));
    timer->next = timerlist;
    timerlist = timer;

    update_time();
}
开发者ID:DIYzzuzpb,项目名称:contiki-mplabx,代码行数:29,代码来源:etimer.c

示例4: contiki_io_layer_data_ready

layer_state_t contiki_io_layer_data_ready(
      layer_connectivity_t* context
    , const void* data
    , const layer_hint_t hint)
{
	contiki_data_t* s = (contiki_data_t*) context->self->user_data;
	const const_data_descriptor_t* buffer   = ( const const_data_descriptor_t* ) data;

	XI_UNUSED(hint);

	s->process = PROCESS_CURRENT();

	if (s->state == WRITTING) {
		return LAYER_STATE_WANT_WRITE;
	} else if (s->state == WRITE_END) {
		s->state = CONNECTED;
		return LAYER_STATE_OK;
	} else if (s->state == ERROR) {
		return LAYER_STATE_ERROR;
	} else if (s->state == CONNECTED) {
		if (buffer != NULL  && buffer->data_size > 0) {
			s->out_buf = (uint8_t *)buffer->data_ptr;
 			s->out_len = buffer->data_size;
 			//s->out_buf[s->out_len] = 0;
 			//xprintf("%s\n", s->out_buf);
 			s->state = WRITTING;
			handle_output(s);
			return LAYER_STATE_WANT_WRITE;
		}
		return LAYER_STATE_OK;
	}
	return LAYER_STATE_ERROR;
}
开发者ID:foss-for-synopsys-dwc-arc-processors,项目名称:libxively,代码行数:33,代码来源:contiki_io_layer.c

示例5: PROCESS_THREAD

/*---------------------------------------------------------------------------*/
PROCESS_THREAD(tcpip_process, ev, data)
{
  PROCESS_BEGIN();
  
#if UIP_TCP
 {
   static unsigned char i;
   
   for(i = 0; i < UIP_LISTENPORTS; ++i) {
     s.listenports[i].port = 0;
   }
   s.p = PROCESS_CURRENT();
 }
#endif

  tcpip_event = process_alloc_event();
  etimer_set(&periodic, CLOCK_SECOND/2);

  uip_init();
  
  while(1) {
    PROCESS_YIELD();
    eventhandler(ev, data);
  }
  
  PROCESS_END();
}
开发者ID:EDAyele,项目名称:ptunes,代码行数:28,代码来源:tcpip.c

示例6: tcpip_init

void
tcpip_init()
{

 #if UIP_TCP
 {
   static unsigned char i;
   
   for(i = 0; i < UIP_LISTENPORTS; ++i) {
     s.listenports[i].port = 0;
   }
   s.p = PROCESS_CURRENT();
 }
#endif
  
  //tcpip_event = process_alloc_event();
//  etimer_set(&periodic, tcpip_process, CLOCK_SECOND/2);
  etimer_set(&periodic, CLOCK_SECOND/2);

  uip_init();

/* initialize RPL if configured for using RPL */
#if UIP_CONF_IPV6_RPL
  rpl_init();
#endif /* UIP_CONF_IPV6_RPL */
}
开发者ID:lepton-distribution,项目名称:lepton-root.scions,代码行数:26,代码来源:tcpip.c

示例7: ctk_filedialog_eventhandler

/*---------------------------------------------------------------------------*/
char
ctk_filedialog_eventhandler(struct ctk_filedialog_state *s,
			    process_event_t ev, process_data_t data)
{
  static struct cfs_dirent dirent;
  
  if(state == STATE_OPEN) {
    if(ev == ctk_signal_widget_activate &&
       data == (process_data_t)&button) {
      ctk_dialog_close();
      state = STATE_CLOSED;
      process_post(PROCESS_CURRENT(), s->ev, &filename);
      return 1;
    } else if(ev == PROCESS_EVENT_CONTINUE &&
	      (process_data_t)s == data) {
      if(cfs_readdir(&dir, &dirent) == 0 &&
	 dirfileptr < MAX_NUMFILES) {
	strncpy(&files[dirfileptr * FILES_WIDTH],
		dirent.name, FILES_WIDTH);
	CTK_WIDGET_REDRAW(&fileslabel);
	++dirfileptr;
	process_post(PROCESS_CURRENT(), PROCESS_EVENT_CONTINUE, s);
      } else {
	fileptr = 0;	
	cfs_closedir(&dir);
      }
      return 1; 
    } else if(ev == ctk_signal_keypress) {
      if((char)(size_t)data == CH_CURS_UP) {
	clearptr();
	if(fileptr > 0) {
	  --fileptr;
	}
	showptr();
	return 1;
      } else if((char)(size_t)data == CH_CURS_DOWN) {
	clearptr();
	if(fileptr < FILES_HEIGHT - 1) {
	  ++fileptr;
	}
	showptr();
	return 1;
      }
    }
  }
  return 0;
}
开发者ID:13416795,项目名称:contiki,代码行数:48,代码来源:ctk-filedialog.c

示例8: tc_condition_wait

/*{ if "tc_condition_wait" in all_syscalls }*/
void tc_condition_wait(ec_tframe_tc_condition_wait_t* frame) {
    thread->ctx.tc_condition_wait.frame = frame;
    thread->syscall = SYSCALL_tc_condition_wait;

    OBS("condition_wait: cond.waiting=%d", frame->cond->waiting);
    frame->cond->waiting_process = PROCESS_CURRENT();
    frame->cond->waiting = true;
}
开发者ID:copton,项目名称:ocram,代码行数:9,代码来源:pal.jinja.c

示例9: tcp_attach

void
tcp_attach(struct uip_conn *conn,
	   void *appstate)
{
  uip_tcp_appstate_t *s;
  s = &conn->appstate;
  s->p = PROCESS_CURRENT();
  s->state = appstate;
}
开发者ID:ajwlucas,项目名称:lib_xtcp,代码行数:9,代码来源:tcpip.c

示例10: icmp6_new

uint8_t
icmp6_new(void *appstate) {
    if(uip_icmp6_conns.appstate.p == PROCESS_NONE) {
        uip_icmp6_conns.appstate.p = PROCESS_CURRENT();
        uip_icmp6_conns.appstate.state = appstate;
        return 0;
    }
    return 1;
}
开发者ID:kenog,项目名称:contiki-inga,代码行数:9,代码来源:tcpip.c

示例11: udp_attach

void
udp_attach(struct uip_udp_conn *conn,
	   void *appstate)
{
  register uip_udp_appstate_t *s;

  s = &conn->appstate;
  s->p = PROCESS_CURRENT();
  s->state = appstate;
}
开发者ID:serflosa,项目名称:torrija_gateway,代码行数:10,代码来源:tcpip.c

示例12: tc_sleep

/*{ if "tc_sleep" in all_syscalls }*/
void tc_sleep(ec_tframe_tc_sleep_t* frame) {
    thread->ctx.tc_sleep.frame = frame;
    thread->syscall = SYSCALL_tc_sleep;

    if (frame->cond) {
        OBS("sleep: tics=%ld, cond.waiting=%d", frame->tics, frame->cond->waiting);
        frame->cond->waiting = true;
        frame->cond->waiting_process = PROCESS_CURRENT();
    } else {
        OBS("sleep: tics=%ld", frame->tics);
    }

    clock_time_t now = clock_time();
    if (frame->tics > now) {
        etimer_set(&thread->ctx.tc_sleep.et, frame->tics - now);
    } else {
        process_post(PROCESS_CURRENT(), PROCESS_EVENT_CONTINUE, &tc_sleep);
    }
}
开发者ID:copton,项目名称:ocram,代码行数:20,代码来源:pal.jinja.c

示例13: interrupt_register

/*---------------------------------------------------------------------------*/
void
interrupt_register(int int_vect)
{
	int i = 0;
	for (; i < INTERRUPT_NUM; i++) {
		if (interrupts[i].int_vect == int_vect) {
			interrupts[i].p = PROCESS_CURRENT();
			break;
		}
	}
}
开发者ID:girish-kumar-710,项目名称:SMeshStudio,代码行数:12,代码来源:interrupt-arch.c

示例14: contiki_io_layer_connect

layer_state_t contiki_io_layer_connect(
	layer_connectivity_t* context
	, const void* data
	, const layer_hint_t hint )
{

 	XI_UNUSED( hint );

	uip_ipaddr_t *ip;
	resolv_status_t dns_status;
    xi_connection_data_t* connection_data;
    layer_t* layer = ( layer_t* ) context->self;
    contiki_data_t* s = (contiki_data_t* ) layer->user_data;
    struct uip_conn *c;

    s->process = PROCESS_CURRENT();
    if (s->state == CONNECTED) {
    	xi_debug_logger( "Connecting to the endpoint [ok]" );
    	return LAYER_STATE_OK;
    } else if (s->state == CONNECTING) {
    	return LAYER_STATE_WANT_WRITE;
    } else if (s->state == CLOSED) {
	    connection_data   = ( xi_connection_data_t* ) data;
	    dns_status = resolv_lookup(connection_data->address, &ip);

	    if (dns_status != RESOLV_STATUS_CACHED) {
	    	if (dns_status ==  RESOLV_STATUS_NOT_FOUND || dns_status == RESOLV_STATUS_ERROR) {
	    		xi_debug_logger( "Getting Host by name [failed]" );
	        	xi_set_err( XI_SOCKET_GETHOSTBYNAME_ERROR );
	        	return LAYER_STATE_ERROR;
	    	}
	    	if (dns_status != RESOLV_STATUS_RESOLVING) {
	    		resolv_query(connection_data->address);
	    	}
	    	return LAYER_STATE_WANT_WRITE;	/* no IP, cannot go further */
	   	}
	   	xi_debug_logger( "Getting Host by name [ok]" );
	    xi_debug_logger( "Connecting to the endpoint..." );

	    c = uip_connect(ip, uip_htons(connection_data->port));
	 	if(c == NULL) {
	        xi_debug_logger( "Connecting to the endpoint [failed]" );
	        xi_set_err( XI_SOCKET_CONNECTION_ERROR );
	        return LAYER_STATE_ERROR;
	    }
	    s->state = CONNECTING;
	    c->appstate.p = &xively_process;
	    c->appstate.state = s;
	    tcpip_poll_tcp(c);
		return LAYER_STATE_WANT_WRITE;
	}

	return LAYER_STATE_ERROR;
}
开发者ID:foss-for-synopsys-dwc-arc-processors,项目名称:libxively,代码行数:54,代码来源:contiki_io_layer.c

示例15: process_post

/*---------------------------------------------------------------------------*/
int
process_post(struct process *p, process_event_t ev, process_data_t data)
{
  static process_num_events_t snum;

  WDTE=0xac;
  
  if(PROCESS_CURRENT() == NULL) {
    printf("process_post: NULL process posts event %d to process '%s', nevents %d\n",
	   ev,PROCESS_NAME_STRING(p), nevents);
  } else {
    printf("process_post: Process '%s' posts event %d to process '%s', nevents %d\n",
	   PROCESS_NAME_STRING(PROCESS_CURRENT()), ev,
	   p == PROCESS_BROADCAST? "<broadcast>": PROCESS_NAME_STRING(p), nevents);
  }
  
  if(nevents == PROCESS_CONF_NUMEVENTS) {
#if DEBUG
    if(p == PROCESS_BROADCAST) {
      printf("soft panic: event queue is full when broadcast event %d was posted from %s\n", ev, PROCESS_NAME_STRING(process_current));
    } else {
      printf("soft panic: event queue is full when event %d was posted to %s frpm %s\n", ev, PROCESS_NAME_STRING(p), PROCESS_NAME_STRING(process_current));
    }
#endif /* DEBUG */
    return PROCESS_ERR_FULL;
  }
  
  snum = (process_num_events_t)(fevent + nevents) % PROCESS_CONF_NUMEVENTS;
  events[snum].ev = ev;
  events[snum].data = data;
  events[snum].p = p;
  ++nevents;

#if PROCESS_CONF_STATS
  if(nevents > process_maxevents) {
    process_maxevents = nevents;
  }
#endif /* PROCESS_CONF_STATS */
  
  return PROCESS_ERR_OK;
}
开发者ID:azengzz,项目名称:contiki_on_78k0,代码行数:42,代码来源:process.c


注:本文中的PROCESS_CURRENT函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。