Wait Queues

From: Carlo Pagano (carlop@Eicon.com)
Date: Mon Dec 11 2000 - 10:43:35 EST


I am trying to modify a driver that worked great on 2.2.16 to 2.4.0-x..
 
My old code was:
 
static struct wait_queue *roundrobin_wait;
static struct wait_queue *task_stop_wait;
 
static struct tq_struct roundrobin_task;
static struct timer_list timeout_timer;
 
...
 
init_timer(&timeout_timer);             
timeout_timer.function = Timer;
timeout_timer.data = (unsigned long)&timer_data;
timeout_timer.expires = jiffies + 3*HZ;
 
void Timer(unsigned long ptr)
{
    struct clientdata *pTimerData = (struct clientdata *) ptr;
 
if (pTimerData->one_shot_queue_task){
        // start the main round robin
        queue_task(&roundrobin_task, &tq_scheduler);
        pTimerData->one_shot_queue_task = FALSE;
    }
 
    /* wake-up the task responsible for the Timeout callbacks round-robin */
    wake_up_interruptible(&roundrobin_wait);
 
    /* re-schedule this Timer function */
    init_timer(&timeout_timer);             
    timeout_timer.function = Timer;
    timeout_timer.data = (unsigned long)&timer_data;
    timeout_timer.expires = jiffies + HZ/100;
    add_timer(&timeout_timer);
}
 
void RoundRobin(void *ptr)
{
    struct clientdata *data = (struct clientdata *) ptr;
 
    interruptible_sleep_on(&roundrobin_wait);
 
    if (data->queue)    // data->queue set to NULL in Stop()
    {
        /* do whatever you want to do here ... */
        OSALTimeoutCallback *pCallback = data->callback;
 
        pCallback->RoundRobinCallbacks();
    }
 
    /* re-register itself, if needed */
    roundrobin_task.routine = RoundRobin; //main_round_robin;
    roundrobin_task.data = (void *) &roundrobin_data;
    if (data->queue)
    {
        queue_task(&roundrobin_task, data->queue);
    }
    else
    {
        wake_up_interruptible(&task_stop_wait);
 
    }
}
 
 
 
 
 
Carlo Pagano
Software Designer
Trisignal Communications, a division of i-data Technology
(514) 832-3603
carlop@trisignal.com
 

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Fri Dec 15 2000 - 21:00:22 EST