[Tinyos-2-commits] CVS: tinyos-2.x/tos/lib/tosthreads/system TinyThreadSchedulerP.nc, 1.4, 1.5

Kevin Klues klueska at users.sourceforge.net
Tue Oct 21 13:05:56 PDT 2008


Update of /cvsroot/tinyos/tinyos-2.x/tos/lib/tosthreads/system
In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv23841

Modified Files:
	TinyThreadSchedulerP.nc 
Log Message:
Changed to only do timer turnoff logic if desired via compiler-tie flag

Index: TinyThreadSchedulerP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/lib/tosthreads/system/TinyThreadSchedulerP.nc,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** TinyThreadSchedulerP.nc	15 Oct 2008 05:41:54 -0000	1.4
--- TinyThreadSchedulerP.nc	21 Oct 2008 20:05:54 -0000	1.5
***************
*** 62,65 ****
--- 62,66 ----
    thread_queue_t ready_queue;
    
+ #ifdef TOSTHREADS_TIMER_OPTIMIZATION   
    void task timerTask() {
      uint8_t temp;
***************
*** 70,73 ****
--- 71,75 ----
        call PreemptionAlarm.startOneShot(TOSTHREAD_PREEMPTION_PERIOD);
    }
+ #endif
    
    /* switch_threads()
***************
*** 139,144 ****
      //if there are no active threads, put the MCU to sleep
      //Then wakeup the TinyOS thread whenever the MCU wakes up again
!     num_runnable_threads--;
! 	post timerTask();
      sleepWhileIdle();
      interrupt(thread);
--- 141,148 ----
      //if there are no active threads, put the MCU to sleep
      //Then wakeup the TinyOS thread whenever the MCU wakes up again
!     #ifdef TOSTHREADS_TIMER_OPTIMIZATION   
!       num_runnable_threads--;
! 	  post timerTask();
! 	#endif
      sleepWhileIdle();
      interrupt(thread);
***************
*** 150,164 ****
     * threads by the thread scheduler.
     */
!    void stop(thread_t* t) {
!      int i;
!      t->state = TOSTHREAD_STATE_INACTIVE;
!      num_runnable_threads--;
!      post timerTask();
!      for(i=0; i<TOSTHREAD_MAX_NUM_THREADS; i++) {
!        if(call BitArrayUtils.getBit(t->joinedOnMe, i))
!          call ThreadScheduler.wakeupThread(i);
! 	 }
!      signal ThreadCleanup.cleanup[t->id]();
!    }
    
    /* This executes and cleans up a thread
--- 154,170 ----
     * threads by the thread scheduler.
     */
!   void stop(thread_t* t) {
!     int i;
!     t->state = TOSTHREAD_STATE_INACTIVE;
!     #ifdef TOSTHREADS_TIMER_OPTIMIZATION        
!       num_runnable_threads--;
!       post timerTask();
!     #endif
!     for(i=0; i<TOSTHREAD_MAX_NUM_THREADS; i++) {
!       if(call BitArrayUtils.getBit(t->joinedOnMe, i))
!         call ThreadScheduler.wakeupThread(i);
!     }
!     signal ThreadCleanup.cleanup[t->id]();
!   }
    
    /* This executes and cleans up a thread
***************
*** 206,211 ****
          t->state = TOSTHREAD_STATE_READY;
          call ThreadQueue.enqueue(&ready_queue, t);
!         num_runnable_threads++;
!         post timerTask();
          return SUCCESS;
        }
--- 212,219 ----
          t->state = TOSTHREAD_STATE_READY;
          call ThreadQueue.enqueue(&ready_queue, t);
!         #ifdef TOSTHREADS_TIMER_OPTIMIZATION   
!           num_runnable_threads++;
!           post timerTask();
!         #endif
          return SUCCESS;
        }
***************
*** 267,275 ****
      if((t->state) == TOSTHREAD_STATE_SUSPENDED) {
        t->state = TOSTHREAD_STATE_READY;
!       if(t != tos_thread) {
!         call ThreadQueue.enqueue(&ready_queue, call ThreadInfo.get[id]());
!         atomic num_runnable_threads++;
!         post timerTask();
!       }
        return SUCCESS;
      }
--- 275,285 ----
      if((t->state) == TOSTHREAD_STATE_SUSPENDED) {
        t->state = TOSTHREAD_STATE_READY;
!         if(t != tos_thread) {
!           call ThreadQueue.enqueue(&ready_queue, call ThreadInfo.get[id]());
!           #ifdef TOSTHREADS_TIMER_OPTIMIZATION   
!             atomic num_runnable_threads++;
!             post timerTask();
!           #endif
!         }
        return SUCCESS;
      }



More information about the Tinyos-2-commits mailing list