thanks i can understand,but in the following simple progamme with two thread,highest priority thread runs continuouslly ,it never dies...so here no need for infinite loop..?
# include <cyg/hal/hal_arch.h># include <cyg/kernel/kapi.h># include <cyg/hal/io.h>
unsigned char ledpio;
// These numbers depend entirely on your application# define NUMBER_OF_WORKERS 4# define PRODUCER_PRIORITY 18# define WORKER_PRIORITY 17# define PRODUCER_STACKSIZE CYGNUM_HAL_STACK_SIZE_TYPICAL# define WORKER_STACKSIZE (CYGNUM_HAL_STACK_SIZE_MINIMUM + 1024)
static unsigned char producer_stack[PRODUCER_STACKSIZE];
static unsigned char worker_stacks[NUMBER_OF_WORKERS][WORKER_STACKSIZE];
static cyg_handle_t producer_handle, worker_handles[NUMBER_OF_WORKERS];
static cyg_thread producer_thread,worker_threads[NUMBER_OF_WORKERS];
static void
producer(cyg_addrword_t data)
{
ledpio = 0x8; //
IOWR (LED_PIO_BASE , 0, ledpio);
}
static void
worker(cyg_addrword_t data)
{
ledpio = 0x1; //
IOWR (LED_PIO_BASE , 0, ledpio);
}
void cyg_user_start(void)
{
int i;
cyg_thread_create(PRODUCER_PRIORITY, &producer, 0, "producer",
producer_stack, PRODUCER_STACKSIZE,
&producer_handle, &producer_thread);
cyg_thread_resume(producer_handle);
for (i = 0; i < NUMBER_OF_WORKERS; i++) {
cyg_thread_create(WORKER_PRIORITY, &worker, i, "worker",
worker_stacks
, worker_stacksize,
&(worker_handles), &(worker_threads
));
cyg_thread_resume(worker_handles);
}
}
--- Quote Start ---
originally posted by glecordier@Feb 8 2006, 06:45 AM
your thread runs once and then dies
you need a infinite loop in
static void ledglow(cyg_addrword_t data)
{
while (1){
ledpio = ledpio^0x10; //
iowr (led_pio_base , 0, ledpio);
}
}
<div align='right'><{post_snapback}> (index.php?act=findpost&pid=12630)
--- quote end ---
--- Quote End ---