(1) Inside the tinyOS event-driven concurrency system, does the atomic section (including called function) occupy the CPU and run until completion, such that even an async event (interrupt) can not preempt it? -- even assume the protected variables has nothing related with the async event functions?

(I just read app.c, seems like that's the way how __nesc_atomic_start implemented, please confirm!)

static inline __nesc_atomic_t __nesc_atomic_start(void )
{
  __nesc_atomic_t result = are_interrupts_enabled();

#line 222
  __nesc_disable_interrupt();
  return result;
}

(2) I have tried to compare SurgeM.nc with app.c under build/telosb. I notice this "atomic" section is not atomic in app.c -- is this a bug? Or when the atomic keyword will be ignored?

  async event result_t Sensor.dataReady(uint16_t data) {      
    atomic {
      if (!gfSendBusy) {
        gfSendBusy = TRUE;     
        gSensorData = data;
        post SendData();
      }
    }
    return SUCCESS;
  }

_______________________________________________
Tinyos-help mailing list
Tinyos-help@Millennium.Berkeley.EDU
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to