Path: news.cs.au.dk!Morten.Grouleff.Mjolner.Informatics From: Morten Grouleff Newsgroups: comp.lang.beta Subject: Re: Concurrency and Processmanager Date: 01 Mar 1999 12:44:29 +0100 Organization: Mjolner Informatics. Lines: 53 Message-ID: References: <19990226205230.18742.qmail@noatun.mjolner.dk> NNTP-Posting-Host: hugin.mjolner.dk Mime-Version: 1.0 (generated by tm-edit 7.106) Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: xinwen.cs.au.dk 920288669 16142 255.255.255.255 (1 Mar 1999 11:44:29 GMT) X-Complaints-To: news@cs.au.dk NNTP-Posting-Date: 1 Mar 1999 11:44:29 GMT X-Newsreader: Gnus v5.5/Emacs 19.34 Xref: news.cs.au.dk comp.lang.beta:11848 "tricos.com Webmaster" writes: > Now for something completely different :) I want start a process from my > BETA program and let it run concurrent with it. The BETA program shows > a window which contains a Cancel-button which should cancel the process > initiated by the program. That is not the problem. If the external > process has finished normally the BETA program should go on with the > normal program, i.e. the normal flow of the program itself. So I can > use myProcess.awaitStopped in the program, which freezes the BETA > program's window, so that the Cancel-button cannot be used. If I use > concurrency via fork, where the forked process awaits the initiated > process to stop, although the forked process is NOT my "normal" program, > the program also freezes. So I can see no possibility to let both parts > run concurrent without any of the parts freezing. It is possible, using the stillRunning pattern. It uses polling and is as such not the perfect solution, but it suffices for most problems. Something like: (Not tested, not even compiled...) doneSem: @Semaphore; waitsys: system (# p: ^Process; killhim: @boolean; do L: (if p.stillRunning then (if killhim then p.stop; leave L; if); 0.1->sleep; restart L if); doneSem.V; #); ws: ^|waitsys; do &|waitsys[]->ws[]; someprocess[]->ws.p[]; ws[]->fork; ... (* Wait for process to stop: *) doneSem.P; Regards, -- ** Morten Grouleff: ** ** Earthworm Jim PC: ** ** Mjølner Informatics: **