Beispiel #1
0
// thread relinquish use of the processor
// and wait in the ready queuee
void th_yield()
{
	entry_section();

	if (threads[curr]->state == RUNNING)
		rq_push(curr);
	else if (threads[curr]->state == WAITING)
		wq_push(curr);

	// transfer the control to the next thread
	if (rq_begin != rq_end) {
		int old = curr;
		
		curr = rq_front();
		rq_pop();

		threads[curr]->state = RUNNING;

		exit_section();
		th_swap(threads[old], threads[curr]);
		entry_section();

		recycle_dead();
	}
	exit_section();
}
critical void getRepPacket(packet_t *thePacket) {
   uint8_t plen, i;
   uint8_t * packet_ptr = (uint8_t *) thePacket;
  
   plen = rq_front() + HEADER_SIZE;
   for (i = 0; i < plen; i++) {
      packet_ptr[i] = rq_pop();
   }
   newRepPacket--;


   // XXX DEBUGGING
   //newUARTPacket++;
}