[Tinyos-2-commits] CVS: tinyos-2.x/tos/lib/net/dip Dip.h, 1.1, 1.2 DisseminatorP.nc, 1.2, 1.3

Kaisen Lin kaisenl at users.sourceforge.net
Sat Feb 16 02:56:11 PST 2008


Update of /cvsroot/tinyos/tinyos-2.x/tos/lib/net/dip
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv32216

Modified Files:
	Dip.h DisseminatorP.nc 
Log Message:
changed() gets signaled from local changes

Index: Dip.h
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/lib/net/dip/Dip.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** Dip.h	3 Jan 2008 21:30:35 -0000	1.1
--- Dip.h	16 Feb 2008 10:56:07 -0000	1.2
***************
*** 20,24 ****
  
  enum {
!   AM_DIP = 0x84
  };
  
--- 20,27 ----
  
  enum {
!   AM_DIP = 0x84,
!   AM_DIP_DATA_MSG = 0x84, // For MIG tool
!   AM_DIP_MSG = 0x84, // For MIG tool
!   AM_DIP_DATA = 0x84 // For MIG tool
  };
  
***************
*** 31,40 ****
  typedef dip_index_t dip_hashlen_t;
  
! typedef nx_struct dip_msg_t {
    nx_uint8_t type; // dip_msgid_t
    nx_uint8_t content[0];
  } dip_msg_t;
  
! typedef nx_struct dip_data_msg_t {
    nx_dip_key_t key;
    nx_dip_version_t version;
--- 34,43 ----
  typedef dip_index_t dip_hashlen_t;
  
! typedef nx_struct dip_msg {
    nx_uint8_t type; // dip_msgid_t
    nx_uint8_t content[0];
  } dip_msg_t;
  
! typedef nx_struct dip_data_msg {
    nx_dip_key_t key;
    nx_dip_version_t version;
***************
*** 43,52 ****
  } dip_data_msg_t;
  
! typedef nx_struct dip_vector_msg_t {
    nx_uint8_t unitLen;
    nx_uint32_t vector[0];
  } dip_vector_msg_t;
  
! typedef nx_struct dip_summary_msg_t {
    nx_uint8_t unitLen;
    nx_uint32_t salt;
--- 46,55 ----
  } dip_data_msg_t;
  
! typedef nx_struct dip_vector_msg {
    nx_uint8_t unitLen;
    nx_uint32_t vector[0];
  } dip_vector_msg_t;
  
! typedef nx_struct dip_summary_msg {
    nx_uint8_t unitLen;
    nx_uint32_t salt;
***************
*** 65,70 ****
  /* TUNABLE PARAMETERS */
  
! typedef struct dip_data_t {
!   uint8_t data[16];
  } dip_data_t;
  
--- 68,73 ----
  /* TUNABLE PARAMETERS */
  
! typedef nx_struct dip_data {
!   nx_uint8_t data[16];
  } dip_data_t;
  

Index: DisseminatorP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/lib/net/dip/DisseminatorP.nc,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** DisseminatorP.nc	3 Jan 2008 21:30:35 -0000	1.2
--- DisseminatorP.nc	16 Feb 2008 10:56:07 -0000	1.3
***************
*** 58,66 ****
  implementation {
    dip_data_t valueCache;
! 
    task void signalNewData() {
      signal AppDisseminationValue.changed();
    }
! 
    command error_t Init.init() {
      call DipHelp.registerKey(key);
--- 58,66 ----
  implementation {
    dip_data_t valueCache;
!   
    task void signalNewData() {
      signal AppDisseminationValue.changed();
    }
!   
    command error_t Init.init() {
      call DipHelp.registerKey(key);
***************
*** 78,81 ****
--- 78,83 ----
    command void AppDisseminationValue.set( const t* val ) {
      memcpy( &valueCache, val, sizeof(t) );
+     // must signal here instead of posting task to prevent race condition
+     signal AppDisseminationValue.changed();
    }
  
***************
*** 86,89 ****
--- 88,92 ----
         it just wants the key, so we cast it recklessly */
      call DipDisseminationUpdate.change((dip_data_t*)newVal);
+     post signalNewData();
    }
  
***************
*** 96,100 ****
    command void DataDisseminationUpdate.change( dip_data_t* newVal ) {
      memcpy( &valueCache, newVal, sizeof(dip_data_t) );
!     //post signalNewData();
      signal AppDisseminationValue.changed();
    }
--- 99,103 ----
    command void DataDisseminationUpdate.change( dip_data_t* newVal ) {
      memcpy( &valueCache, newVal, sizeof(dip_data_t) );
!     // don't post the task, this came from the network
      signal AppDisseminationValue.changed();
    }



More information about the Tinyos-2-commits mailing list