I've found 2 ways to shared time between threads at the same priority that seem to work well. Here's some psuedo-code...
For 'cooperative', just have the thread that is yielding do... pthread_wakeup_np(other_thread); pthread_suspend_np(pthread_self()); If you want it preemptive, make a 3rd thread that is at a higher priority, and from that thread do... loop( figure out next_thread ) { pthread_wakeup_np(next_thread); clock_nanosleep(clock, timeslice); pthread_suspend_np(next_thread); } Either of these should get what you're after. -Dave i. > > > I hope we can achieve it with SCHED_RR. > > --- Ish Rattan <[EMAIL PROTECTED]> wrote: > > On Wed, 23 Jan 2002 [EMAIL PROTECTED] wrote: > > > > > I have two threads with the same priority running > > from the same module > > > and I'd like to share CPU time between the two > > threads equally, is it > > > possible? > > > > Probably not. Thread runs to completion if it is > > cpu-bound. If not a it > > reschedules when it issues a service request. > > Suspend/wakeup can work if > > if thread suspends/wakes up after correct interval. > > The solution will > > be based on the nature of threads. > > > > -ishwar > > > > -- [rtl] --- > > To unsubscribe: > > echo "unsubscribe rtl" | mail [EMAIL PROTECTED] > > OR > > echo "unsubscribe rtl <Your_email>" | mail > > [EMAIL PROTECTED] > > -- > > For more information on Real-Time Linux see: > > http://www.rtlinux.org/ > > > > > __________________________________________________ > Do You Yahoo!? > Great stuff seeking new owners in Yahoo! Auctions! > http://auctions.yahoo.com > -- [rtl] --- > To unsubscribe: > echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR > echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED] > -- > For more information on Real-Time Linux see: > http://www.rtlinux.org/ > > -- [rtl] --- To unsubscribe: echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED] -- For more information on Real-Time Linux see: http://www.rtlinux.org/