[prev in list] [next in list] [prev in thread] [next in thread] 

List:       linux-rt
Subject:    Re: [Rtl] wakeup a rt thread.
From:       Der Herr Hofrat <der.herr () hofr ! at>
Date:       2005-02-15 12:33:33
Message-ID: 200502151233.j1FCXXx13565 () hofr ! at
[Download RAW message or body]

> 
> Hi all...
> 
> 
>  is there a difference in waking up a rt-thread using the
> 
> 	pthread_wakeup_np(threadx)
> 
> instruction and doing the same with the
> 
>         pthread_kill(threadx, RTL_SIGNAL_WAKEUP);      
>  
> 
> instruction ? If I'm not wrong, the first one calls immediatly the
> scheduler... is the same for the second ?

yup - pthread_wakeup_np calls the scheduler imediately wereas pthread_kill
only marks the signal pending and continues. 

pthread_wakeup_np actually is just a wrapper to:

	pthread_kill(,RTL_SiGNAL_WAKEUP);
	rtl_schedule(); 

which is the same thing as the POSIX way for imediate signal delivery:
	
	pthread_kill(,RTL_SiGNAL_WAKEUP);
	pthread_yield();

And in many cases you want to do 

	pthread_kill(,RTL_SiGNAL_WAKEUP);
	pthread_yield();
	pthread_testcancel();

to ensure handling of pending singals.

Using the POSIX semantics is the better way of doing it simply because
its a well defined API and documented - you will find this scheme in 
books on POSIX threads .

hofrat
_______________________________________________
Rtl mailing list
Rtl@rtlinux.org
http://www2.fsmlabs.com/mailman/listinfo/rtl
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic