Messages in this thread | | | From | Carlo Pagano <> | Subject | Wait Queues | Date | Mon, 11 Dec 2000 10:43:35 -0500 |
| |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD> <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META content="MSHTML 5.50.4134.600" name=GENERATOR></HEAD> <BODY bgColor=#ffffff> <DIV><FONT face=Tahoma size=2>I am trying to modify a driver that worked great on 2.2.16 to 2.4.0-x..</FONT></DIV> <DIV> </DIV> <DIV><FONT face=Tahoma size=2>My old code was:</FONT></DIV> <DIV> </DIV> <DIV><FONT face=Tahoma size=2>static struct wait_queue *roundrobin_wait; <BR>static struct wait_queue *task_stop_wait; <BR> <BR>static struct tq_struct roundrobin_task; <BR>static struct timer_list timeout_timer; </FONT></DIV> <DIV> </DIV> <DIV><FONT face=Tahoma size=2>...</FONT></DIV> <DIV> </DIV> <DIV><FONT face=Tahoma size=2>init_timer(&timeout_timer); <BR>timeout_timer.function = Timer; <BR>timeout_timer.data = (unsigned long)&timer_data; <BR>timeout_timer.expires = jiffies + 3*HZ;</FONT></DIV> <DIV> </DIV> <DIV><FONT face=Tahoma size=2>void Timer(unsigned long ptr) <BR>{ <BR> struct clientdata *pTimerData = (struct clientdata *) ptr;</FONT></DIV> <DIV> </DIV> <DIV><FONT face=Tahoma size=2>if (pTimerData->one_shot_queue_task){<BR> // start the main round robin<BR> queue_task(&roundrobin_task, &tq_scheduler); <BR> pTimerData->one_shot_queue_task = FALSE;<BR> }</FONT></DIV> <DIV> </DIV> <DIV><FONT face=Tahoma size=2> /* wake-up the task responsible for the Timeout callbacks round-robin */<BR> wake_up_interruptible(&roundrobin_wait); </FONT></DIV> <DIV> </DIV> <DIV><FONT face=Tahoma size=2> /* re-schedule this Timer function */<BR> init_timer(&timeout_timer); <BR> timeout_timer.function = Timer; <BR> timeout_timer.data = (unsigned long)&timer_data; <BR> timeout_timer.expires = jiffies + HZ/100; <BR> add_timer(&timeout_timer); <BR>} <BR> <BR>void RoundRobin(void *ptr) <BR>{ <BR> struct clientdata *data = (struct clientdata *) ptr;</FONT></DIV> <DIV> </DIV> <DIV><FONT face=Tahoma size=2> interruptible_sleep_on(&roundrobin_wait); </FONT></DIV> <DIV> </DIV> <DIV><FONT face=Tahoma size=2> if (data->queue) // data->queue set to NULL in Stop()<BR> {<BR> /* do whatever you want to do here ... */ <BR> OSALTimeoutCallback *pCallback = data->callback; </FONT></DIV> <DIV> </DIV> <DIV><FONT face=Tahoma size=2> pCallback->RoundRobinCallbacks(); <BR> }</FONT></DIV> <DIV> </DIV> <DIV><FONT face=Tahoma size=2> /* re-register itself, if needed */ <BR> roundrobin_task.routine = RoundRobin; //main_round_robin; <BR> roundrobin_task.data = (void *) &roundrobin_data; <BR> if (data->queue)<BR> { <BR> queue_task(&roundrobin_task, data->queue); <BR> } <BR> else <BR> { <BR> wake_up_interruptible(&task_stop_wait); </FONT></DIV> <DIV> </DIV> <DIV><FONT face=Tahoma size=2> } <BR>} </FONT></DIV> <DIV> </DIV> <DIV><FONT face=Tahoma size=2></FONT> </DIV> <DIV> </DIV> <DIV><FONT face=Tahoma size=2></FONT> </DIV> <DIV> </DIV> <DIV><FONT face=Tahoma size=2><STRONG>Carlo Pagano</STRONG></FONT></DIV> <DIV><FONT face=Tahoma size=2>Software Designer</FONT></DIV> <DIV><FONT face=Tahoma size=2>Trisignal Communications, a division of i-data Technology</FONT></DIV> <DIV><FONT face=Tahoma size=2>(514) 832-3603</FONT></DIV> <DIV><A href="mailto:carlop@trisignal.com"><FONT face=Tahoma size=2>carlop@trisignal.com</FONT></A></DIV> <DIV> </DIV></BODY></HTML>
| |