91a Subj : Re: how to use specific context before thread switch To : comp.programming.threads,comp.os.linux.development.apps,comp.realtime From : Andre Gompel Date : Wed May 18 2005 02:35 pm Gold+ares: in UC/OS-II you achieve this by changing the task priority since the scheduler is called upon return from an ISR. In Linux/Unix, you should be able to use the same scheme, but to fully understand what you are trying to do, you should probably explain what your ISR simulation thread is exactly doing, I have to admit missing this part of the picture. You have to carefully look at the IPC (interprocess communications) to see how a task can wake up another task (by mean of a semaphore), and/or change another task priority. Suggestion: read Richard Stevens excellent book: "Advanced Programming in the UNIX(R) Environment". Another good book on the topic by John Shapley Gray: "Interprocess Communications in Unix: the Nooks and Crannies ". Aslo look at systme primitives like lock_kernel(), unlock_kernel() and other kernel semaphores functions. On line, Unix at FermiLab: you could start there: (See Chapter 6) I hope this helps. Andre Gompel. ---------- gold+ares+REMOVE-IT@gmail.com.invalid wrote: > hello guys , i have a problem > > i am porting ucosii to linuxbox with threads method. > > I want to use 2 threads. One thread called "ISR-Thread" which simulate > ISR , and the other thread called "Task-Thread" includes all tasks used > by ucosii and each task has their own stack and register context. > > suppose there are two tasks in "Task-Thread" which are "a-Task" and > "b-Task". And "a-Task" is running and "b-Task" is not running when > program jump to "ISR-Thread" from "Task-Thread" to do with interrupt. > > But something changes and program should run "b-task" instead of > "a-stask" when program return form "ISR-Thread" to "Task-Thread". > > My problem is how to jump directly to "b-task" instead of "a-stask" when > program returns form "ISR-Thread" to "Task-Thread"?? > > And should I modify the saved context of "Task-Thread" or not before > program returns form "ISR-Thread" to "Task-Thread" and how to do it?? > > thanks in advance > > . 0