From fcc2e7c301fe39960c3b7da49686cfa4e000f294 Mon Sep 17 00:00:00 2001 From: scipio Date: Sat, 16 Feb 2008 01:31:50 +0000 Subject: [PATCH] Signal changed() on change(). --- tos/lib/net/drip/DisseminatorP.nc | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tos/lib/net/drip/DisseminatorP.nc b/tos/lib/net/drip/DisseminatorP.nc index 1dff2394..b9584fcd 100644 --- a/tos/lib/net/drip/DisseminatorP.nc +++ b/tos/lib/net/drip/DisseminatorP.nc @@ -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() { -- 2.39.2