Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: st: Capture break in mata
From
George Vega Yon <[email protected]>
To
[email protected]
Subject
Re: st: Capture break in mata
Date
Tue, 1 Oct 2013 18:28:05 -0300
Dear James and Phill,
Thanks for your replies.
Phill, thanks for the correction. I'm not sure why but my text editor
erased the "++" symbols both from the -while- and the -for- (that's
why you can see two blank spaces right after -i- and -j-) Still, I
don't get what I want.
James, your function looks interesting, I'll check it out in detail.
In this case I don't need to capture any error (I don't expect to have
any, as what I'm doing is a simple loop), I need to capture the break
key. I know that Stata handles the break key smartly, but for this
case it is not enough because I need to stop processes running outside
Stata.
As my module -parallel- starts several Stata instances I need a way to
stop these in the case that the user pressed the break key in the
mother process. In pseudo code:
NITER = 0
WHILE NITER++ < MAXITER DO
IF all child instances have stoped THEN
BREAK
IF Break key is pressed THEN
Tell all child instances to stop
BREAK
END
Once a child process stops, it writes a plaintext file which tells the
mother process how it ended (which is currently working in
-parallel-). If the user press the break key I need the mother process
to write a plaintext file in order to every child gets to know that
the mother needs them to stop.
I know how to do this in Stata but, as -parallel- is now fully written
in Mata, I wanted to fully run it in Mata.
Thanks again!
George Vega
________________________________