bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Re: thread_suspend()


From: kurian kattukaren
Subject: Re: Re: thread_suspend()
Date: 30 Aug 2001 14:55:54 -0000

On Thu, 30 Aug 2001 Thomas Bushnell, BSG wrote :
>"kurian  kattukaren" <kjk_bugs@rediffmail.com> writes:
>
>> On Thu, 30 Aug 2001 Thomas Bushnell, BSG wrote :
>> >"kurian  kattukaren" <kjk_bugs@rediffmail.com> 
>writes:
>> >
>> >>             When the thread suspended call is made,
> 
>> >does
>> >> the kernel schedule another thread to run. This 
>> >cropped
>> >> up while trying to implementing schedule_timeout.
>> >
>> >Exactly which call are you talking about?
>>  thread_suspend(thread_t thread);
>
>I should have been more careful in my answer.
>
>If the argument to thread_suspend is the currently 
>running thread,
>then of course it suspends and some other thread begins 
>running.
>
>If you suspend some *other* thread, then in general the 
>current thread
>just keeps on running until its time quantum is up.

Thomas, sorry for taking the subject off list. I just realised it now.

Will this do for schedule_timeout().

Here is the main portion of the schedule timeout function:

thread_t current = mach_current_thread();
int long schedule_timeout(long int timeout)
 {
        expire = timeout + jiffies;

        init_timer(&timer);
        timer.expires = expire;
        timer.data = (unsigned long) current;
        timer.function = process_timeout;

        add_timer(&timer);
  /*      schedule(); */
        thread_suspend(current);
        thread_resume(current);
        del_timer_sync(&timer);

        timeout = expire - jiffies;
}

void process_timeout(long data)
 {
  return;
 }
In the linux code, process_timeout is called so that
the process is added to the runqueue and available to run.
    for us when the thread is suspended the thread is still on the runqueue so 
that in case the thread is 
selected to run it can do so.

So do we really require process_timeout()?

 






reply via email to

[Prev in Thread] Current Thread [Next in Thread]