
-----------------------------------
the_avenger
Mon Jan 30, 2006 6:45 pm

is there a way to exit a fork.
-----------------------------------
is there a way to exit a fork?

-----------------------------------
Delos
Mon Jan 30, 2006 7:32 pm


-----------------------------------
Several possibilities:
- Don't use processes.  They're not well handled in Turing and require a great deal of skill to pull off.
- If you must, I'm guessing that the one in question has a loop in it.  You could create an exit condition that would be satisfied by a global variable, that could be changed by another proc.
- Look into wait, signal, and possibly monitor.  AFAIK, there are no tuts available for these, since they are so rarely used (as we try to discourage the use of processes as much as possible, for the above mentioned reasons).

-----------------------------------
Martin
Mon Jan 30, 2006 7:33 pm


-----------------------------------
It'll exit whenever the process is finished running.


var killProcess : boolean := false

process myProcess
   loop
      exit when killProcess
      put "process!"
   end loop
end process

fork myProcess
delay (2000)
killProcess := true

But yeah, using processes is a bad idea - they will result in you having bad and slow code that is difficult to debug.

-----------------------------------
redrenagade
Thu Feb 02, 2006 4:54 pm


-----------------------------------
You would always try to declare a string type variable.
Then in the loop within the process, type "exit when string_variable := " stop". Then, when u want the process to stop, simply have a line of code that looks like this:
string_variable := "stop" 
This should stop the process effectively, atleast it did for my program anyway.

-----------------------------------
Cervantes
Thu Feb 02, 2006 6:04 pm


-----------------------------------
Then in the loop within the process, type "exit when string_variable := " stop".
Except, Turing uses "=" for comparison, and ":=" for assignment.

The bottom line is, "Most should [url=http://www.compsci.ca/v2/viewtopic.php?t=7842]avoid processes".

-----------------------------------
jrblast
Wed Feb 08, 2006 2:53 pm


-----------------------------------
Then in the loop within the process, type "exit when string_variable := " stop".
Except, Turing uses "=" for comparison, and ":=" for assignment.

The bottom line is, "Most should 

From my experience, and the above linked tutorial, NEVER use turing processes for anything other than music or other sounds.
