2000-12-11 16:13:32

by Carlo Pagano

[permalink] [raw]
Subject: Wait Queues

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
[email protected]
?