]> oss.titaniummirror.com Git - tinyos-2.x.git/commitdiff
Signal changed() on change().
authorscipio <scipio>
Sat, 16 Feb 2008 01:31:50 +0000 (01:31 +0000)
committerscipio <scipio>
Sat, 16 Feb 2008 01:31:50 +0000 (01:31 +0000)
tos/lib/net/drip/DisseminatorP.nc

index 1dff239417e53566dcbc5071658f1996d712b135..b9584fcdf7147078e033d33a391b7864560133fa 100644 (file)
@@ -80,7 +80,9 @@ implementation {
   }
 
   command void DisseminationValue.set( const t* val ) {
-    valueCache = *val;
+    if (seqno == DISSEMINATION_SEQNO_UNKNOWN) {
+      valueCache = *val;
+    }
   }
 
   command void DisseminationUpdate.change( t* newVal ) {
@@ -105,7 +107,11 @@ implementation {
                                             uint32_t newSeqno ) {
     memcpy( &valueCache, data, size < sizeof(t) ? size : sizeof(t) );
     seqno = newSeqno;
-    post changedTask();
+    // We need to signal here and can't go through a task to
+    // ensure that the update and changed event are atomic.
+    // Otherwise, it is possible that storeData is called,
+    // but before the task runs, the client calls set(). -pal
+    signal DisseminationValue.changed();
   }
 
   command uint32_t DisseminationCache.requestSeqno() {