Hi David,

I have one more patch suggestion for the C SDK, to build upon your recent 
update to CVS.  With the latest code and using a blocking serial source, one 
can get into a situation where the SDK has buffered one or more packets 
internally but it still blocks to do IO on the tty when calling 
read_serial_packet.  Here's the call graph:

read_serial_packet(src, &len);
read_and_process(src, src->non_blocking); /* nb is FALSE */
read_byte(src, non_blocking);
serial_read(src, non_blocking, buffer, len);
select(...);

Patch below.  Thanks!
Steve

--- /home/smckown/tmp/tinyos-2.x/support/sdk/c/serialsource.c   2007-07-05 
10:02:50.000000000 -0600
+++ serialsource.c      2007-07-13 19:52:03.000000000 -0600
@@ -627,11 +634,11 @@
      the serial source is in non-blocking mode
 */
 {
+  read_and_process(src, TRUE);
   for (;;)
     {
       struct packet_list *entry;

-      read_and_process(src, src->non_blocking);
       entry = pop_protocol_packet(src, P_PACKET_NO_ACK);
       if (entry)
        {
@@ -645,6 +652,7 @@
       if (src->non_blocking && serial_source_empty(src))
        return NULL;
       source_wait(src, NULL);
+      read_and_process(src, src->non_blocking);
     }
 }
_______________________________________________
Tinyos-help mailing list
[email protected]
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to