• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ PT_END函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: PT_THREAD


//.........这里部分代码省略.........
	static exosite_http_context_t *opContext;
	int status;

	do
	{
		printf("data_write_thread():\r\n");
		if(!is_http_op_context_existed(EXO_OP_MODE_WRITE))
			break;

		opContext = get_http_op_context(EXO_OP_MODE_WRITE);

		if(exoHttpContextQueue.deviceStatus != EXO_DEVICE_STATE_INITIALIZED)
		{
			struct pt actPt;

			PT_SPAWN(pt, &actPt, data_activate_thread(&actPt));

			exoHttpContextQueue.deviceStatus = EXO_DEVICE_STATE_INITIALIZED;
		}

		if(!build_http_msg(opContext))
		{
			release_op(opContext);
			break;
		}

		if(!exosite_pal_sock_write( &opContext->sock,
									opContext->pdu,
									strlen(opContext->pdu)))
		{
			opContext->opStatus = -1;

			opContext->resultCallback(	NULL,
										opContext->opStatus);

			close_socket(&opContext->sock);
			release_op(opContext);
			break;
		}

		PT_YIELD(pt);

		memset(dataBuf, 0, sizeof(dataBuf));
		size_t bufLen = sizeof(dataBuf);

		exosite_pal_timer_init(&opContext->waitTimer);
		exosite_pal_timer_countdown_ms(&opContext->waitTimer, WAIT_TIME_MS);

		bool isReadData = true;
		while(exosite_pal_sock_read(	&opContext->sock,
										dataBuf,
										&bufLen) == 0)
		{
			PT_YIELD(pt);
			if(exosite_pal_timer_expired(&opContext->waitTimer))
			{
				opContext->opStatus = -1;

				opContext->resultCallback(	NULL,
											opContext->opStatus);

				close_socket(&opContext->sock);
				release_op(opContext);

				isReadData = false;
				break;
			}
		}

		if(!isReadData)
			break;

		printf("data_write_thread(): got rsp\r\n");


		if(parse_rsp_status(dataBuf,
							bufLen,
							&status))
		{
			opContext->opStatus = status;
			opContext->resultCallback(	NULL,
										opContext->opStatus);

			release_op(opContext);

			check_http_error_status_to_determine_if_reset_cik(status);
		}

		printf("rsp status = %d\r\n", status);

		if(status == 401 || status == 403)
		{
			struct pt actPt;

			PT_SPAWN(pt, &actPt, data_activate_thread(&actPt));
		}
	} while(false);

PT_END(pt);
}
开发者ID:cgm7487,项目名称:exosite_device,代码行数:101,代码来源:exosite_http.c


示例2: PT_THREAD

/*---------------------------------------------------------------------*/
static
PT_THREAD(recv_udpthread(struct pt *pt))
{
  int len;
  struct codeprop_udphdr *uh = (struct codeprop_udphdr *)uip_appdata;

  /*  if(uip_newdata()) {
    PRINTF(("recv_udpthread: id %d uh->id %d\n", s.id, htons(uh->id)));
    }*/

  PT_BEGIN(pt);

  while(1) {

    do {
      PT_WAIT_UNTIL(pt, uip_newdata() &&
		    uh->type == HTONS(TYPE_DATA) &&
		    htons(uh->id) > s.id);

      if(htons(uh->addr) != 0) {
	s.addr = 0;
	send_nack(uh, 0);
      }

    } while(htons(uh->addr) != 0);

    /*    leds_on(LEDS_YELLOW);
	  beep_down(10000);*/

    s.addr = 0;
    s.id = htons(uh->id);
    s.len = htons(uh->len);

    timer_set(&s.timer, CONNECTION_TIMEOUT);
/*     process_post(PROCESS_BROADCAST, codeprop_event_quit, (process_data_t)NULL); */

    while(s.addr < s.len) {

      if(htons(uh->addr) == s.addr) {
	/*	leds_blink();*/
	len = uip_datalen() - UDPHEADERSIZE;
	if(len > 0) {
	  /*	  eeprom_write(EEPROMFS_ADDR_CODEPROP + s.addr,
		  &uh->data[0], len);*/
	  cfs_seek(fd, s.addr, CFS_SEEK_SET);
	  cfs_write(fd, &uh->data[0], len);

	  /*	  beep();*/
	  PRINTF(("Saved %d bytes at address %d, %d bytes left\n",
		  uip_datalen() - UDPHEADERSIZE, s.addr,
		  s.len - s.addr));

	  s.addr += len;
	}

      } else if(htons(uh->addr) > s.addr) {
	PRINTF(("sending nack since 0x%x != 0x%x\n", htons(uh->addr), s.addr));
	send_nack(uh, s.addr);
      }

      if(s.addr < s.len) {

	/*	timer_set(&s.nacktimer, NACK_TIMEOUT);*/

	do {
	  timer_set(&s.nacktimer, HIT_NACK_TIMEOUT);
	  PT_YIELD_UNTIL(pt, timer_expired(&s.nacktimer) ||
			 (uip_newdata() &&
			  uh->type == HTONS(TYPE_DATA) &&
			  htons(uh->id) == s.id));
	  if(timer_expired(&s.nacktimer)) {
	    send_nack(uh, s.addr);
	  }
	} while(timer_expired(&s.nacktimer));
      }

    }

    /*    leds_off(LEDS_YELLOW);
	  beep_quick(2);*/
    /*    printf("Received entire bunary over udr\n");*/
    codeprop_start_program();
    PT_EXIT(pt);
  }

  PT_END(pt);
}
开发者ID:EDAyele,项目名称:ptunes,代码行数:88,代码来源:codeprop-tmp.c


示例3: PT_THREAD


//.........这里部分代码省略.........
      s.ticks *= 2;
    }
  }
  
 selecting:
// printf("selecting\n");
  xid++;
  s.ticks = CLOCK_SECOND;
  do {
    while(ev != tcpip_event) {
      tcpip_poll_udp(s.conn);
      PT_YIELD(&s.pt);
    }
    send_request();
    etimer_set(&s.etimer, s.ticks);
    do {
      PT_YIELD(&s.pt);
      if(ev == tcpip_event && uip_newdata() && msg_for_me() == DHCPACK) {
	parse_msg();
	s.state = STATE_CONFIG_RECEIVED;
	goto bound;
      }
    } while (!etimer_expired(&s.etimer));

    if(s.ticks <= CLOCK_SECOND * 10) {
      s.ticks += CLOCK_SECOND;
    } else {
      goto init;
    }
  } while(s.state != STATE_CONFIG_RECEIVED);
  
 bound:
#if 0
  printf("Got IP address %d.%d.%d.%d\n", uip_ipaddr_to_quad(&s.ipaddr));
  printf("Got netmask %d.%d.%d.%d\n",	 uip_ipaddr_to_quad(&s.netmask));
  printf("Got DNS server %d.%d.%d.%d\n", uip_ipaddr_to_quad(&s.dnsaddr));
  printf("Got default router %d.%d.%d.%d\n",
	 uip_ipaddr_to_quad(&s.default_router));
  printf("Lease expires in %ld seconds\n",
	 uip_ntohs(s.lease_time[0])*65536ul + uip_ntohs(s.lease_time[1]));
#endif
//  printf("bound\n");

  ip64_dhcpc_configured(&s);
  
#define MAX_TICKS (~((clock_time_t)0) / 2)
#define MAX_TICKS32 (~((uint32_t)0))
#define IMIN(a, b) ((a) < (b) ? (a) : (b))

  if((uip_ntohs(s.lease_time[0])*65536ul + uip_ntohs(s.lease_time[1]))*CLOCK_SECOND/2
     <= MAX_TICKS32) {
    s.ticks = (uip_ntohs(s.lease_time[0])*65536ul + uip_ntohs(s.lease_time[1])
	       )*CLOCK_SECOND/2;
  } else {
    s.ticks = MAX_TICKS32;
  }

  while(s.ticks > 0) {
    ticks = IMIN(s.ticks, MAX_TICKS);
    s.ticks -= ticks;
    etimer_set(&s.etimer, ticks);
    PT_YIELD_UNTIL(&s.pt, etimer_expired(&s.etimer));
  }

  if((uip_ntohs(s.lease_time[0])*65536ul + uip_ntohs(s.lease_time[1]))*CLOCK_SECOND/2
     <= MAX_TICKS32) {
    s.ticks = (uip_ntohs(s.lease_time[0])*65536ul + uip_ntohs(s.lease_time[1])
	       )*CLOCK_SECOND/2;
  } else {
    s.ticks = MAX_TICKS32;
  }

  /* renewing: */
  xid++;
  do {
    while(ev != tcpip_event) {
      tcpip_poll_udp(s.conn);
      PT_YIELD(&s.pt);
    }
    send_request();
    ticks = IMIN(s.ticks / 2, MAX_TICKS);
    s.ticks -= ticks;
    etimer_set(&s.etimer, ticks);
    do {
      PT_YIELD(&s.pt);
      if(ev == tcpip_event && uip_newdata() && msg_for_me() == DHCPACK) {
	parse_msg();
	goto bound;
      }
    } while(!etimer_expired(&s.etimer));
  } while(s.ticks >= CLOCK_SECOND*3);

  /* rebinding: */

  /* lease_expired: */
  ip64_dhcpc_unconfigured(&s);
  goto init;

  PT_END(&s.pt);
}
开发者ID:examyes,项目名称:SMeshStudio,代码行数:101,代码来源:dhcpv4.c


示例4: console_thread

static int console_thread(struct pt *pt)
{
	struct console_cxt *c = to_console_cxt(pt);	/* always called */
	static char ch;

	PT_BEGIN(pt);
	if (c->flags & S_WRITEMODE) {
		c->size = 0;
		while (c->size < c->max_size) {
			ch = *c->buf;
			if ((c->flags & S_LINEMODE) && ch == '\0')
				goto out;
			c->size++;
			c->buf++;
			/* '\n' -> '\r\n' */
			if ((c->flags & S_CRLF) && ch == '\n')
				TX_IN('\r');
			TX_IN(ch);
		}

	} else {
		c->size = 0;
		for (;;) {
rx_again:
			if ((c->flags & S_READLINE) == 0 &&
					c->size >= c->max_size)
				goto out;

			RX_OUT(ch);

			/* only support backspace (or del) */
			if ((c->flags & S_READLINE) &&
					(ch == '\b' || ch == 0x7f)) {
				if (c->size > 0) {
					c->size--;
					c->buf--;
					TX_IN('\b');
					TX_IN(' ');
					TX_IN('\b');
				}
				goto rx_again;
			}

			if ((c->flags & S_LINEMODE) &&
					(ch == '\r' || ch == '\n')) {
				if (c->size < c->max_size)
					*c->buf = '\0';
				goto out;
			}

			if ((c->flags & S_ECHO))
				TX_IN(ch);

			/* stop at max */
			if ((c->flags & S_READLINE) && c->size >= c->max_size)
				goto rx_again;

			*c->buf++ = ch;
			c->size++;
		}
	}
out:
	PT_YIELD(pt);

	PT_END(pt);
}
开发者ID:jadonk,项目名称:pruduino,代码行数:66,代码来源:ws28xx-pru0.c


示例5: dutycycle


//.........这里部分代码省略.........
 * (re)start the duty cycling.
 */
static int
dutycycle(void *ptr)
{
  struct ctimer *t = ptr;
	
  PT_BEGIN(&dutycycle_pt);

  while(1) {

#if WITH_PENDING_BROADCAST
    {
	/* Before sending the probe, we mark all broadcast packets in
	   our output queue to be pending. This means that they are
	   ready to be sent, once we know that no neighbor is
	   currently broadcasting. */
      for(p = list_head(queued_packets_list); p != NULL; p = list_item_next(p)) {
	  if(p->broadcast_flag == BROADCAST_FLAG_WAITING) {
	    PRINTF("wait -> pending\n");
	    set_broadcast_flag(p, BROADCAST_FLAG_PENDING);
	  }
	}
      }
#endif /* WITH_PENDING_BROADCAST */
    
    /* Turn on the radio for sending a probe packet and 
       anticipating a data packet from a neighbor. */
    turn_radio_on();

    /* Send a probe packet. */
    send_probe();

    /* Set a timer so that we keep the radio on for LISTEN_TIME. */
    ctimer_set(t, LISTEN_TIME, (void (*)(void *))dutycycle, t);
    PT_YIELD(&dutycycle_pt);

#if WITH_PENDING_BROADCAST
    {
      struct queue_list_item *p;
      /* Go through the list of packets we are waiting to send, and
	 check if there are any pending broadcasts in the list. If
	 there are pending broadcasts, and we did not receive any
	 broadcast packets from a neighbor in response to our probe,
	 we mark the broadcasts as being ready to send. */
      for(p = list_head(queued_packets_list); p != NULL; p = list_item_next(p)) {
	if(p->broadcast_flag == BROADCAST_FLAG_PENDING) {
	  PRINTF("pending -> send\n");
	  set_broadcast_flag(p, BROADCAST_FLAG_SEND);
	  turn_radio_on();
	}
      }
    }
#endif /* WITH_PENDING_BROADCAST */

    /* If we have no packets to send (indicated by the list length of
       queued_packets_list being zero), we should turn the radio
       off. Othersize, we keep the radio on. */
    if(num_packets_to_send() == 0) {
      
      /* If we are not listening for announcements, we turn the radio
	 off and wait until we send the next probe. */
      if(is_listening == 0) {
        int current_off_time;
        if(!NETSTACK_RADIO.receiving_packet()) {
          turn_radio_off();
          compower_accumulate(&compower_idle_activity);
        }
        current_off_time = off_time - off_time_adjustment;
        if(current_off_time < LISTEN_TIME * 2) {
          current_off_time = LISTEN_TIME * 2;
        }
        off_time_adjustment = 0;
	ctimer_set(t, current_off_time, (void (*)(void *))dutycycle, t);
	PT_YIELD(&dutycycle_pt);

#if WITH_ADAPTIVE_OFF_TIME
	off_time += LOWEST_OFF_TIME;
	if(off_time > OFF_TIME) {
	  off_time = OFF_TIME;
	}
#endif /* WITH_ADAPTIVE_OFF_TIME */

      } else {
	/* We are listening for annonucements, so we count down the
	   listen time, and keep the radio on. */
	is_listening--;
	ctimer_set(t, OFF_TIME, (void (*)(void *))dutycycle, t);
	PT_YIELD(&dutycycle_pt);
      }
    } else {
      /* We had pending packets to send, so we do not turn the radio off. */

      ctimer_set(t, off_time, (void (*)(void *))dutycycle, t);
      PT_YIELD(&dutycycle_pt);
    }
  }

  PT_END(&dutycycle_pt);
}
开发者ID:CaptFrank,项目名称:contiki-stm32w,代码行数:101,代码来源:lpp.c


示例6: PT_THREAD

static PT_THREAD(protothread_CSense(struct pt *pt)) {
    PT_BEGIN(pt);
    while (1) {

        if (config1 & CUR_SENSE_EN) {
            if(Status2 & M7_CUR){
                if(M7_LastDir != M7_Dir)//if direction has changed, lower CS flag, which enables PWM writing
                    Status2 &= !M7_CUR; 
            }
            if(Status2 & M6_CUR){
                if(M6_LastDir != M6_Dir)
                    Status2 &= !M6_CUR; 
            }
            if(Status2 & M6_CUR){
                if(M6_LastDir != M6_Dir)
                    Status2 &= !M6_CUR; 
            }
            if(Status2 & M5_CUR){
                if(M5_LastDir != M5_Dir)
                    Status2 &= !M5_CUR; 
            }
            if(Status2 & M4_CUR){
                if(M4_LastDir != M4_Dir)
                    Status2 &= !M4_CUR; 
            }
            if(Status2 & M3_CUR){
                if(M3_LastDir != M3_Dir)
                    Status2 &= !M3_CUR; 
            }            
            if (mPORTBReadBits(BIT_3)) {//CS triggered!
                M7_PWM = 0;
                SetDCOC1PWM(M7_PWM);//Halt motor
                Status2 |= M7_CUR;//set CS flag
                M7_LastDir = M7_Dir;//save direction
                
            }
            if (mPORTBReadBits(BIT_1)) {
                M6_PWM = 0;
                SetDCOC2PWM(M6_PWM);
                Status2 |= M6_CUR;
                M6_LastDir = M6_Dir;
                
            }
            if (mPORTAReadBits(BIT_3)) {
                M5_PWM = 0;
                SetDCOC3PWM(M5_PWM);
                Status2 |= M5_CUR;
                M5_LastDir = M5_Dir;
                
            }
            if (mPORTBReadBits(BIT_4)) {
                M4_PWM = 0;
                SetDCOC5PWM(M4_PWM);
                Status2 |= M4_CUR;
                M4_LastDir = M4_Dir;
                
            }
            if (mPORTAReadBits(BIT_4)) {
                M3_PWM = 0;
                SetDCOC4PWM(M3_PWM);
                Status2 |= M3_CUR;
                M3_LastDir = M3_Dir;
            }
        }
        PT_YIELD_TIME_msec(10);

    }
    PT_END(pt);

}
开发者ID:CornellMarsRover,项目名称:CMR_PIC32_code,代码行数:70,代码来源:MCU4.c


示例7: PT_THREAD

static
PT_THREAD(handle_script(struct httpd_state *s))
{
  /* Note script includes will attach a leading : to the filename and a trailing zero */
  static char scriptname[MAX_SCRIPT_NAME_LENGTH+1],*pptr;
  static uint16_t filelength;

  PT_BEGIN(&s->scriptpt);

  filelength=s->file.len;
  while(s->file.len > 0) {
    /* Sanity check */
    if (s->file.len > filelength) break;

    /* Check if we should start executing a script, flagged by %! */
    if(httpd_fs_getchar(s->file.data) == ISO_percent &&
       httpd_fs_getchar(s->file.data + 1) == ISO_bang) {

       /* Extract name, if starts with colon include file else call cgi */
       s->scriptptr=get_scriptname(scriptname,s->file.data+2);
       s->scriptlen=s->file.len-(s->scriptptr-s->file.data);
       PRINTF("httpd: Handle script named %s\n",scriptname);
       if(scriptname[0] == ISO_colon) {
         if (httpd_fs_open(&scriptname[1], &s->file)) {
           PT_WAIT_THREAD(&s->scriptpt, send_file(s));
         }
       } else {
         PT_WAIT_THREAD(&s->scriptpt,httpd_cgi(scriptname)(s, s->scriptptr));
       }
       next_scriptstate(s);
      
      /* Reset the pointers and continue sending the current file. */
      s->file.data = s->scriptptr;
      s->file.len  = s->scriptlen;
    } else {

     /* Send file up to the next potential script */
      if(s->file.len > uip_mss()) {
        s->len = uip_mss();
      } else {
        s->len = s->file.len;
      }

      if(httpd_fs_getchar(s->file.data) == ISO_percent) {
        pptr = (char *) httpd_fs_strchr(s->file.data + 1, ISO_percent);
      } else {
        pptr = (char *) httpd_fs_strchr(s->file.data, ISO_percent);
      }

      if(pptr != NULL && pptr != s->file.data) {
        s->len = (int)(pptr - s->file.data);
        if(s->len >= uip_mss()) {
          s->len = uip_mss();
        }
      }
      PRINTF("httpd: Sending %u bytes from 0x%04x\n",s->file.len,(unsigned int)s->file.data);
      PT_WAIT_THREAD(&s->scriptpt, send_part_of_file(s));
      s->file.data += s->len;
      s->file.len  -= s->len;
    }
  }

  PT_END(&s->scriptpt);
}
开发者ID:Ammar-85,项目名称:contiki-arduino,代码行数:64,代码来源:httpd.c


示例8: PT_THREAD

/*---------------------------------------------------------------------------*/
static
PT_THREAD(connect_pt(struct pt* pt, struct mqtt_connection* conn))
{
  PT_BEGIN(pt);

  DBG("MQTT - Sending CONNECT message...\r\n");

  /* Set up FHDR */
  conn->out_packet.fhdr = MQTT_FHDR_MSG_TYPE_CONNECT;
  conn->out_packet.remaining_length = 0;
  conn->out_packet.remaining_length += MQTT_connect_vhdr_flags_SIZE;
  conn->out_packet.remaining_length += MQTT_STRING_LENGTH(&conn->client_id);
  conn->out_packet.remaining_length += MQTT_STRING_LENGTH(&conn->credentials.username);
  conn->out_packet.remaining_length += MQTT_STRING_LENGTH(&conn->credentials.password);
  conn->out_packet.remaining_length += MQTT_STRING_LENGTH(&conn->will.topic);
  conn->out_packet.remaining_length += MQTT_STRING_LENGTH(&conn->will.message);
  encode_remaining_length(conn->out_packet.remaining_length_enc,
                          &conn->out_packet.remaining_length_enc_bytes,
                          conn->out_packet.remaining_length);
  if(conn->out_packet.remaining_length_enc_bytes > 4) {
    call_event(conn, MQTT_EVENT_PROTOCOL_ERROR, NULL);
    printf("MQTT - Error, remaining length > 4 bytes\r\n");
    PT_EXIT(pt);
  }

  /* Write Fixed Header */
  PT_MQTT_WRITE_BYTE(conn, conn->out_packet.fhdr);
  PT_MQTT_WRITE_BYTES(conn,
                      conn->out_packet.remaining_length_enc,
                      conn->out_packet.remaining_length_enc_bytes);
  PT_MQTT_WRITE_BYTE(conn, 0);
  PT_MQTT_WRITE_BYTE(conn, 6);
  PT_MQTT_WRITE_BYTES(conn, (uint8_t*)MQTT_PROTOCOL_NAME, 6);
  PT_MQTT_WRITE_BYTE(conn, MQTT_PROTOCOL_VERSION);
  PT_MQTT_WRITE_BYTE(conn, conn->connect_vhdr_flags);
  PT_MQTT_WRITE_BYTE(conn, (conn->keep_alive >> 8));
  PT_MQTT_WRITE_BYTE(conn, (conn->keep_alive & 0x00FF));
  PT_MQTT_WRITE_BYTE(conn, conn->client_id.length << 8);
  PT_MQTT_WRITE_BYTE(conn, conn->client_id.length & 0x00FF);
  PT_MQTT_WRITE_BYTES(conn, conn->client_id.string, conn->client_id.length);
  if(conn->connect_vhdr_flags & MQTT_VHDR_WILL_FLAG) {
    PT_MQTT_WRITE_BYTE(conn, conn->will.topic.length << 8);
    PT_MQTT_WRITE_BYTE(conn, conn->will.topic.length & 0x00FF);
    PT_MQTT_WRITE_BYTES(conn, conn->will.topic.string, conn->will.topic.length);
    PT_MQTT_WRITE_BYTE(conn, conn->will.message.length << 8);
    PT_MQTT_WRITE_BYTE(conn, conn->will.message.length & 0x00FF);
    PT_MQTT_WRITE_BYTES(conn, conn->will.message.string, conn->will.message.length);
    DBG("MQTT - Setting will topic to '%s' %i bytes and message to '%s' %i bytes\r\n",
        conn->will.topic.string,
        conn->will.topic.length,
        conn->will.message.string,
        conn->will.message.length);
  }
  if(conn->connect_vhdr_flags & MQTT_VHDR_USERNAME_FLAG) {
    DBG("MQTT - Setting username\r\n");
    PT_MQTT_WRITE_BYTE(conn, conn->credentials.username.length << 8);
    PT_MQTT_WRITE_BYTE(conn, conn->credentials.username.length & 0x00FF);
    PT_MQTT_WRITE_BYTES(conn,
                        conn->credentials.username.string,
                        conn->credentials.username.length);
  }
  if(conn->connect_vhdr_flags & MQTT_VHDR_PASSWORD_FLAG) {
    DBG("MQTT - Setting password\r\n");    
    PT_MQTT_WRITE_BYTE(conn, conn->credentials.password.length << 8);
    PT_MQTT_WRITE_BYTE(conn, conn->credentials.password.length & 0x00FF);
    PT_MQTT_WRITE_BYTES(conn,
                        conn->credentials.password.string,
                        conn->credentials.password.length);
  }

  /* Send out buffer */
  send_out_buffer(conn);
  conn->state = MQTT_CONN_STATE_CONNECTING_TO_BROKER;

  /* Wait for CONNACK */
  reset_packet(&conn->in_packet);
  do {
    PT_WAIT_UNTIL(pt, conn->out_packet.qos_state == MQTT_QOS_STATE_GOT_ACK);
  } while(conn->out_packet.qos_state != MQTT_QOS_STATE_GOT_ACK);
  reset_packet(&conn->in_packet);

  DBG("MQTT - Done sending CONNECT since we got CONNACK!\r\n");

#if DEBUG_MQTT == 1
  DBG("MQTT - Sending CONNECT message: \r\n");
  uint16_t i;
  for( i = 0; i < (conn->out_buffer_ptr - conn->out_buffer); i++ ) {
    DBG( "%02X ", conn->out_buffer[i] );
  }
  DBG("\r\n");
#endif

  PT_END(pt);
}
开发者ID:jackyz,项目名称:Thingsquare-Mist,代码行数:95,代码来源:mqtt.c


示例9: PT_THREAD

static PT_THREAD(handle_bl(void))
{
	PT_BEGIN(&s.pt);
	s.retries = 3;
	do
	{
		flash_init();
		tftpc_init();
		tftpc_get(FIRMWARE_FILENAME);

		PT_WAIT_UNTIL(&s.pt, !tftpc_busy());

		uint8_t rc = tftpc_result();
		if(rc == TFTPC_FLASH_ERROR)
		{
			// any flash write errors, make sure the code doesn't run
			invalidate_code();
		}

		// valid app code in place?
		if(!check_valid_code())
		{
			// figure out what happened
			// and set indicator
			switch(rc) {
			case TFTPC_SUCCESS:
				diag_set(1);
				s.retries--;
				break;
			case TFTPC_SERVER_DOWN:
				diag_set(2);
				break;
			case TFTPC_FILE_NOT_FOUND:
				diag_set(3);
				break;
			case TFTPC_ERROR:
				diag_set(4);
				s.retries--;
				break;
			case TFTPC_FLASH_ERROR:
				diag_set(5);
				s.retries--;
				break;
			}

		}
		else
		{
			run_app();
		}

		timer_set(&s.timer, RETRY_TIME);
		PT_WAIT_UNTIL(&s.pt, timer_expired(&s.timer));
	} while (s.retries > 0);

	while(1)
	{
		PT_YIELD(&s.pt);
	}

	PT_END(&s.pt);
}
开发者ID:marcelommcouto,项目名称:FTPUploader_Bootloader,代码行数:62,代码来源:bootloaderapp.c


示例10: powercycle


//.........这里部分代码省略.........
          if(NETSTACK_RADIO.channel_clear() == 0) {
            packet_seen = 1;
            break;
          }
          powercycle_turn_radio_off();
        }
        schedule_powercycle_fixed(t, RTIMER_NOW() + CCA_SLEEP_TIME);
        /*        COOJA_DEBUG_STR("yield\n");*/
        PT_YIELD(&pt);
      }
      
      if(packet_seen) {
        static rtimer_clock_t start;
        static uint8_t silence_periods, periods;
        start = RTIMER_NOW();
        
        periods = silence_periods = 0;
        while(we_are_sending == 0 && radio_is_on &&
              RTIMER_CLOCK_LT(RTIMER_NOW(), (start + LISTEN_TIME_AFTER_PACKET_DETECTED))) {
          
          /* Check for a number of consecutive periods of
             non-activity. If we see two such periods, we turn the
             radio off. Also, if a packet has been successfully
             received (as indicated by the
             NETSTACK_RADIO.pending_packet() function), we stop
             snooping. */
          if(NETSTACK_RADIO.channel_clear()) {
            ++silence_periods;
          } else {
            silence_periods = 0;
          }
          
          ++periods;
        
          if(NETSTACK_RADIO.receiving_packet()) {
            silence_periods = 0;
          }
          if(silence_periods > MAX_SILENCE_PERIODS) {
            LEDS_ON(LEDS_RED);
            powercycle_turn_radio_off();
#if CONTIKIMAC_CONF_COMPOWER
            compower_accumulate(&compower_idle_activity);
#endif /* CONTIKIMAC_CONF_COMPOWER */
            LEDS_OFF(LEDS_RED);
            break;
          }
#if 1
          if(periods > MAX_NONACTIVITY_PERIODIC && !(NETSTACK_RADIO.receiving_packet() ||
                                                     NETSTACK_RADIO.pending_packet())) {
            LEDS_ON(LEDS_GREEN);
            powercycle_turn_radio_off();
#if CONTIKIMAC_CONF_COMPOWER
            compower_accumulate(&compower_idle_activity);
#endif /* CONTIKIMAC_CONF_COMPOWER */
            
            LEDS_OFF(LEDS_GREEN);
            break;
          }
#endif /* 0 */
          if(NETSTACK_RADIO.pending_packet()) {
            break;
          }
          
          schedule_powercycle(t, CCA_CHECK_TIME + CCA_SLEEP_TIME);
          LEDS_ON(LEDS_BLUE);
          PT_YIELD(&pt);
          LEDS_OFF(LEDS_BLUE);
        }
        if(radio_is_on && !(NETSTACK_RADIO.receiving_packet() ||
                            NETSTACK_RADIO.pending_packet())) {
          LEDS_ON(LEDS_RED + LEDS_GREEN);
          powercycle_turn_radio_off();
#if CONTIKIMAC_CONF_COMPOWER
          compower_accumulate(&compower_idle_activity);
#endif /* CONTIKIMAC_CONF_COMPOWER */
          LEDS_OFF(LEDS_RED + LEDS_GREEN);
        }
      } else {
#if CONTIKIMAC_CONF_COMPOWER
        compower_accumulate(&compower_idle_activity);
#endif /* CONTIKIMAC_CONF_COMPOWER */
      }
    } while(is_snooping &&
            RTIMER_CLOCK_LT(RTIMER_NOW() - cycle_start, CYCLE_TIME - CHECK_TIME));

    if(is_snooping) {
      LEDS_ON(LEDS_RED);
    }
    if(RTIMER_CLOCK_LT(RTIMER_NOW() - cycle_start, CYCLE_TIME)) {
      /*      schedule_powercycle(t, CYCLE_TIME - (RTIMER_NOW() - cycle_start));*/
      schedule_powercycle_fixed(t, CYCLE_TIME + cycle_start);
      /*      printf("cycle_start 0x%02x now 0x%02x wait 0x%02x\n",
              cycle_start, RTIMER_NOW(), CYCLE_TIME - (RTIMER_NOW() - cycle_start));*/
      PT_YIELD(&pt);
    }
    LEDS_OFF(LEDS_RED);
  }

  PT_END(&pt);
}
开发者ID:project-master-device,项目名称:project-master-device,代码行数:101,代码来源:contikimac.c


示例11: PT_THREAD

/*---------------------------------------------------------------------*/
static
PT_THREAD(recv_tcpthread(struct pt *pt))
{
  PT_BEGIN(pt);

  /* Read the header. */
  PT_WAIT_UNTIL(pt, uip_newdata() && uip_datalen() > 0);

  if(uip_datalen() < sizeof(struct codeprop_tcphdr)) {
    PRINTF(("codeprop: header not found in first tcp segment\n"));
    uip_abort();
    goto thread_done;
  }

  /* Kill old program. */
  rudolph0_stop(&rudolph0);
  /*  elfloader_unload();*/
  
  s.len = htons(((struct codeprop_tcphdr *)uip_appdata)->len);
  s.addr = 0;
  uip_appdata += sizeof(struct codeprop_tcphdr);
  uip_len -= sizeof(struct codeprop_tcphdr);

  s.fd = cfs_open("codeprop.out", CFS_WRITE);
  cfs_close(s.fd);
  /*  xmem_erase(XMEM_ERASE_UNIT_SIZE, EEPROMFS_ADDR_CODEPROP);*/

  /* Read the rest of the data. */
  do {
    leds_toggle(LEDS_RED);
    if(uip_len > 0) {
      s.fd = cfs_open("codeprop.out", CFS_WRITE + CFS_APPEND);
      cfs_seek(s.fd, s.addr, CFS_SEEK_SET);
      /*      xmem_pwrite(uip_appdata, uip_len, EEPROMFS_ADDR_CODEPROP + s.addr);*/
      cfs_write(s.fd, uip_appdata, uip_len);
      cfs_close(s.fd);
      
      PRINTF("Wrote %d bytes to file\n", uip_len);
      s.addr += uip_len;
    }
    if(s.addr < s.len) {
      PT_YIELD_UNTIL(pt, uip_newdata());
    }
  } while(s.addr < s.len);
  leds_off(LEDS_RED);

#if DEBUG
  {
    int i, fd, j;
    printf("Contents of file:\n");
    fd = cfs_open("codeprop.out", CFS_READ);
    j = 0;
    printf("\n0x%04x: ", 0);
    for(i = 0; i < s.len; ++i) {
      unsigned char byte;
      cfs_read(fd, &byte, 1);
      printf("0x%02x, ", byte);
      ++j;
      if(j == 8) {
	printf("\n0x%04x: ", i + 1);
	j = 0;
      }
      clock_delay(400);
    }
    cfs_close(fd);
  }
#endif

  int ret;
  
  ret = start_program();
  
#if CONTIKI_TARGET_NETSIM
  rudolph0_send(&rudolph0, CLOCK_SECOND / 4);
#else /* CONTIKI_TARGET_NETSIM */
  if(ret == ELFLOADER_OK) {
    /* Propagate program. */
    rudolph0_send(&rudolph0, CLOCK_SECOND / 4);
  }
#endif /* CONTIKI_TARGET_NETSIM */
  
  /* Return "ok" message. */
  do {
    ret = strlen(msg);
    uip_send(msg, ret);
    PT_WAIT_UNTIL(pt, uip_acked() || uip_rexmit() || uip_closed());
  } while(uip_rexmit());

  /* Close the connection. */
  uip_close();

    
 thread_done:;
  PT_END(pt);
}
开发者ID:arbraham,项目名称:hummingbird,代码行数:96,代码来源:tcprudolph0.c


示例12: PT_THREAD

static
PT_THREAD(recv_tcpthread(struct pt *pt))
{
  struct codeprop_tcphdr *th;
  int datalen = uip_datalen();
  PT_BEGIN(pt);

  while(1) {

    PT_WAIT_UNTIL(pt, uip_connected());

    codeprop_exit_program();
    
    s.state = STATE_RECEIVING_TCPDATA;

    s.addr = 0;
    s.count = 0;

    /* Read the header. */
    PT_WAIT_UNTIL(pt, uip_newdata() && uip_datalen() > 0);

    if(uip_datalen() < CODEPROP_TCPHDR_SIZE) {
      PRINTF(("codeprop: header not found in first tcp segment\n"));
      uip_abort();
    }
    th = (struct codeprop_tcphdr *)uip_appdata;
    s.len = uip_htons(th->len);
    s.addr = 0;
    uip_appdata += CODEPROP_TCPHDR_SIZE;
    datalen -= CODEPROP_TCPHDR_SIZE;
    
    /* Read the rest of the data. */
    do {
      if(datalen > 0) {
	/* printf("Got %d bytes\n", datalen); */

	if (cfs_seek(fd, s.addr, CFS_SEEK_SET) != s.addr) {
	   PRINTF(("codeprop: seek in buffer file failed\n"));
	   uip_abort();
	}
					     
	if (cfs_write(fd, uip_appdata, datalen) != datalen) {
	  PRINTF(("codeprop: write to buffer file failed\n"));
	  uip_abort();
	}
	s.addr += datalen;
      }
      if(s.addr < s.len) {
	PT_YIELD_UNTIL(pt, uip_newdata());
      }
    } while(s.addr < s.len);
#if 1
    
    {
      static int err;
      
      err = codeprop_start_program();
      
      /* Print out the "OK"/error message. */
      do {
	if (err >= 0 && err < sizeof(err_msgs)/sizeof(char*)) {
	  uip_send(err_msgs[err], strlen(err_msgs[err]));
	} else {
	  uip_send("Unknown error\r\n", 15);
	}
	PT_WAIT_UNTIL(pt, uip_acked() || uip_rexmit() || uip_closed());
      } while(uip_rexmit());
      
      /* Close the connection. */
      uip_close();
    }
#endif
    ++s.id;
    s.state = STATE_SENDING_UDPDATA;
    tcpip_poll_udp(udp_conn);

    PT_WAIT_UNTIL(pt, s.state != STATE_SENDING_UDPDATA);
    /*    printf("recv_tcpthread: unblocked\n");*/
  }

  PT_END(pt);
}
开发者ID:13416795,项目名称:contiki,代码行数:82,代码来源:codeprop-otf.c


示例13: PT_THREAD

static PT_THREAD (protothread_cmd(struct pt *pt))
{
    PT_BEGIN(pt);
      while(1) {
          
            // send the prompt via DMA to serial
            sprintf(PT_send_buffer,"cmd>");
            // by spawning a print thread
            PT_SPAWN(pt, &pt_DMA_output, PT_DMA_PutSerialBuffer(&pt_DMA_output) );
 
          //spawn a thread to handle terminal input
            // the input thread waits for input
            // -- BUT does NOT block other threads
            // string is returned in "PT_term_buffer"
            PT_SPAWN(pt, &pt_input, PT_GetSerialBuffer(&pt_input) );
            // returns when the thread dies
            // in this case, when <enter> is pushed
            // now parse the string
             sscanf(PT_term_buffer, "%s %d", cmd, &value);
         

             
              if (cmd[0]=='d' ) {
                //set mux to DSP chip
                mPORTAClearBits(BIT_4);
                mPORTBClearBits(BIT_13);
                mPORTASetBits(BIT_4);
                mPORTBClearBits(BIT_3 | BIT_7 | BIT_8 | BIT_9);
                 
                 if(((value << 6) & (0x0040))){
                     mPORTBSetBits(BIT_3);
                 }
                     //select sound effect
                 mPORTBSetBits(value << 6);
                 }
             if (cmd[0] == 's'){ //distortion
                 //set mux to Distortion
                mPORTAClearBits(BIT_4);
                mPORTBClearBits(BIT_13);
             }
             if (cmd[0] == 'n'){ //normal: only tone stack
                 //set mux to channel 0
                mPORTAClearBits(BIT_4);
                mPORTBClearBits(BIT_13);
                mPORTBSetBits(BIT_13);
             }
             //pots
             if (cmd[0] == 't'){ //treble
                // CS low to start transaction
                mPORTBClearBits(BIT_4); // start transaction
                deliverSPICh1Datum(value);
                // CS high
                mPORTBSetBits(BIT_4); // end transaction
             }
             if (cmd[0] == 'b'){ //bass
                // CS low to start transaction
                mPORTAClearBits(BIT_0); // start transaction
                deliverSPICh1Datum(value);
                // CS high
                mPORTASetBits(BIT_0); // end transaction
            }
            if (cmd[0] == 'v'){ //level
                // CS low to start transaction
                    mPORTAClearBits(BIT_2); // start transaction
                    deliverSPICh1Datum(value);                              
                     // CS high
                    mPORTASetBits(BIT_2); // end transaction
            }
            if (cmd[0] == 'm'){ //mid
                // CS low to start transaction
                mPORTAClearBits(BIT_3); // start transaction
                deliverSPICh1Datum(value);
                // CS high
                mPORTASetBits(BIT_3); // end transaction
            }
                          
            // never exit while
      } // END WHILE(1)
  PT_END(pt);
} // thread 3
开发者ID:SamirDurvasula,项目名称:GuitarAmp,代码行数:80,代码来源:TFT_ADC_read.c


示例14: PT_THREAD


//.........这里部分代码省略.........
		if (err) {
			shell_output_P(&owtest_command, PSTR("Match ROM failed\n"));
			PT_EXIT(pt);
		}
	}

	// Start temperature conversion
	err = ow_write_byte(0x44);
	if (err) {
		shell_output_P(&owtest_command, PSTR("Convert T failed\n"));
		PT_EXIT(pt);
	}

	// Conversion timeout
	timer_set(&timeout, DS18B20_CONV_TIMEOUT);
	while (1) {
		_delay_ms(10); // for good measure

		// Read a bit from the bus
		int ret = ow_read_bit();

		// Check for stop conditions
		if (ret == 1) {
			break;
		}
		else if (ret == -1) {
			shell_output_P(&owtest_command, PSTR("Read status failed.\n"));
			PT_EXIT(pt);
		}
		else if (timer_expired(&timeout)) {
			shell_output_P(&owtest_command, PSTR("Conversion has taken too long. Giving up.\n"));
			PT_EXIT(pt);
		}

		// Poll the process and yield the thread
		process_poll(&shell_owtest_process);
		PT_YIELD(pt);
	}

	// Reset and MATCH ROM again
	err = ow_reset();
	if (err != 1) {
		shell_output_P(&owtest_command, PSTR("Reset failed.\n"));
		PT_EXIT(pt);
	}

	// Match ROM
	err = ow_write_byte(0x55);
	if (err) {
		shell_output_P(&owtest_command, PSTR("Match ROM failed\n"));
		PT_EXIT(pt);
	}
	for (int i = 0; i < sizeof(*addr); i++) {
		err = ow_write_byte(addr->u[i]);
		if (err) {
			shell_output_P(&owtest_command, PSTR("Match ROM failed\n"));
			PT_EXIT(pt);
		}
	}

	// Read the scratch pad
	err = ow_write_byte(0xBE);
	if (err) {
		shell_output_P(&owtest_command, PSTR("Read scratch pad failed\n"));
		PT_EXIT(pt);
	}

	for (int i = 0; i < sizeof(scratch); i++) {
		err = ow_read_byte();
		if (err < 0) {
			shell_output_P(&owtest_command, PSTR("Read byte failed\n"));
			PT_EXIT(pt);
		}

		scratch[i] = err;
		crc = _crc_ibutton_update(crc, scratch[i]);
	}

	// Make sure the CRC is valid
	if (crc) {
		shell_output_P(&owtest_command, PSTR("CRC check failed!\n"));
		PT_EXIT(pt);
	}

	// Convert temperature to floating point
	int16_t rawtemp = scratch[0] | (scratch[1] << 8);
	float temp = (float)rawtemp * 0.0625;

	shell_output_P(&owtest_command, 
		PSTR("Scratchpad: %02x%02x %02x%02x %02x %02x%02x%02x %02x\n"),
		scratch[0], scratch[1], // temperature
		scratch[2], scratch[3], // TH,TL alarm thresholds
		scratch[4], // config
		scratch[5], scratch[6], scratch[7], // reserved
		scratch[8]); // CRC

	shell_output_P(&owtest_command, PSTR("Reading: %0.2fC\n"), temp);

	PT_END(pt);
}
开发者ID:bootc,项目名称:PolyController,代码行数:101,代码来源:shell-owtest.c


示例15: power_cycle


//.........这里部分代码省略.........
                schedule_fixed(rt, tnow + 3*TS_20P);
                PT_YIELD(&pt);

                //Once the cycle returns, it is time to send the second beacon
                //transmit Anchor Probe Here
                tnow = RTIMER_NOW();

                //send second beacon with offset
                beacon_2_flag = 1;

                //trabsmit beacon packet
		if(list_access_flag == 0)
		    transmit_epidemic();
				

                //here we schedule to comence the next time slot.
                schedule_fixed(rt, tnow + 2*TS_20P +overflow_flag*TS_20P);
                PT_YIELD(&pt);

                //we need to switch the radio off..
                if(radio_is_on_flag == 1){
                    //COOJA_DEBUG_PRINTF("b17\n");
		    /**if(node_id == 16)
		      COOJA_DEBUG_PRINTF("b17\n");*/
                    off();
                }                
                
                //RESET txPacketFlag
                txPacketFlag = 0;//RESET txPacketFlag
                
            }else{ //END if(txPacketFlag)

                //turn radio off
                if(radio_is_on_flag == 1){
                    //COOJA_DEBUG_PRINTF("b17\n");
                    off();
                }

		if(sort_gains_flag){
		  
		      sort_gains_flag = 0;
		      /*get current number of neighbors..
		       ACC: compute updates here..*/
		      uint8_t tmp_num_neighs = 0;		      		      
		      
		      //if(list_access_flag == 0){
			  //list_access_flag = 1;
			  //tmp_num_neighs = compute_slot_gain(probe_offset);
			  
			  //sort slot gains here..
			  sort_slot_gains();
			  
			  //list_access_flag = 0;

			  tmp_num_neighs = neighs_num_nodes();
			  
			  if(curr_frac_nodes < tmp_num_neighs){
			      ///set current number of neighbors
			      curr_frac_nodes = tmp_num_neighs;

			      process_post(&output_process,PROCESS_EVENT_CONTINUE, NULL);
			  }
			  			  
		      //} //end of list_access_flag == 0	
		}                
                //here we schedule to comence the next time slot.
                schedule_fixed(rt, RTIMER_NOW() + TS);
                PT_YIELD(&pt);
		

            } //END if(txPacketFlag)

            //print energy consumption
            if(slot_counter != 0 && (slot_counter % period_length) == 0){

                //print energy consumption values
                ////print_nodes(1);
	      
                //process_post(&output_process,PROCESS_EVENT_CONTINUE, energyPrint);

                //energy_per_period = 0;
                //extra_probe_per_period = 0;
            }

        } //END for LOOP

        COOJA_DEBUG_PRINTF("END oF DISCOVERY CYCLE:%u\n", rounds_counter);
        //AN UPPER_BOUND HAVE BEEN REACHED.. Exit the
	
        discovery_is_on = 0;
        restart_discovery();

        //cycle is over, YIELD waiting for another call..
        PT_YIELD(&pt);

    }//end of WHILE(1)

    //end protothread function:AG
    PT_END(&pt);
}
开发者ID:aoboy,项目名称:acc-slight,代码行数:101,代码来源:acc-sl.c


示例16: PT_THREAD

/*---------------------------------------------------------------------------*/
static
PT_THREAD(handle_output(struct httpd_state *s))
{
	char *ptr;
  
	PT_BEGIN(&s->outputpt);
 
	if(!httpd_fs_open(s->filename, &s->file)) {
		//printf(" HTTP file %s tidak ada\n", s->filename);
		httpd_fs_open(http_404_html, &s->file);
    	strcpy(s->filename, http_404_html);
    	PT_WAIT_THREAD(&s->outputpt,
			   send_headers(s,
			   http_header_404));
	    PT_WAIT_THREAD(&s->outputpt,
			   send_file(s));

	} else {
//*		
		#ifdef PAKAI_HTTP
		if (strncmp(s->filename, "/about", 6) == 0) {
			//printf(" Buat file about\r\n");
			
			buat_file_about();
			
			s->file.len = strlen(tot_buf);
			
			portENTER_CRITICAL();
			s->file.data = tot_buf;
			portEXIT_CRITICAL();
		}

		else if (strncmp(s->filename, "/setting", 8) == 0) {
			//printf(" Buat file setting: %s\r\n", s->filename);
			if (strncmp(s->filename,"/setting.html?u=1",17)==0) {
				ganti_setting(s->filename);
				buat_file_setting(1, s->filename);
			} else if (strncmp(s->filename,"/setting.html?smb=1",19)==0) {
				buat_file_setting(2, s->filename);
			} else if (strncmp(s->filename,"/setting.html?smb=3",19)==0) 
			{
				buat_file_setting(3, s->filename);
				printf("buat_file_setting: OK\r\n");
			} 
			else if (strncmp(s->filename,"/setting.html?smb=4",19)==0) {
				buat_file_setting(4, s->filename);
			#ifdef TES_GET_WEB
			} else if (strncmp(s->filename,"/setting.html?smb=5",19)==0) {
				buat_file_setting(5, s->filename);
			#endif
			} else {
				buat_file_setting(0,"");
			}

			s->file.len = strlen(tot_buf);
			printf("Kirim file ke client. len: %d\n",s->file.len);		
			portENTER_CRITICAL();
			s->file.data = tot_buf;
			portEXIT_CRITICAL();

		} 
		#ifdef PAKAI_PM
		else if (strncmp(s->filename, "/index.html?sbr=1", 17) == 0) {
			buat_file_index(1, s->filename);
			s->file.len = strlen(tot_buf);
			portENTER_CRITICAL();
			s->file.data = tot_buf;
			portEXIT_CRITICAL();

		} 
		#endif
		else {
			//printf(" Buat file index\r\n");
			buat_file_index(0, "");
			s->file.len = strlen(tot_buf);
			portENTER_CRITICAL();
			s->file.data = tot_buf;
			portEXIT_CRITICAL();
		}
		#endif
	
		PT_WAIT_THREAD(&s->outputpt, send_headers(s, http_header_200));
		ptr = strchr(s->filename, ISO_period);
		
		if(ptr != NULL && strncmp(ptr, http_shtml, 6) == 0) {
			//printf(" script !\n");
			PT_INIT(&s->scriptpt);
			PT_WAIT_THREAD(&s->outputpt, handle_script(s));
		} else {
			//printf(" biasa !\n");
			PT_WAIT_THREAD(&s->outputpt, send_file(s));
		}
	}
	PSOCK_CLOSE(&s->sout);
	PT_END(&s->outputpt);
}
开发者ID:hericz,项目名称:atinom_banyu,代码行数:97,代码来源:httpd.c


示例17: PT_THREAD

该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ PT_INIT函数代码示例发布时间:2022-05-30
下一篇:
C++ PTX函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap