On Sun, Nov 4, 2012 at 12:13 PM, <[email protected]> wrote:
>
> > The typical way to stop a program that uses ooDialog is through
> > the cancel or ok buttons and let the ok() and cancel() methods
> > of the base class end the dialog.
>
> Thank you, I found now that I have to add a '::method leaving' and
> there I may bring down all possible TCPIP sockets congruently
> waiting in blocking mode.
>
The leaving() method is a good place to do clean up. It is not correct to
say you "have" to add the method. You could code your clean up in the ok()
or cancel() also.
Alas I have not found yet a way to 'force' the other thread. This
> must be possible from within the program because I may use Ctrl+C
> on the control window (with a socket command hanging in blocking
> mode I have to press it twice) and the program _is_ stopped.
>
I think your logic is a little faulty here. Just because you can
externally kill a Rexx program does not necessarily mean you *must* be able
to kill it from within the program.
>
> > Your case is complicated by the fact that you are starting
> > another thread in the dialog object that doesn't end.
>
> > Essentially what you need to do is write an ok() and a cancel()
> > method that over-rides the base class. In those methods, you
> > will need to signal your second thread to quit, wait for it to
> > quit, and then invoke the superclass method to close the dialog.
>
> Well, when I press OK or Cancle I do not want to wait for the
> second thread to quit, I want to force it as I don't mind what it
> does when me, myself and I hit QUIT! How may I rise a 'halt
> execution' or break or you-name-it to end at once?
>
I don't know of any way to do that. You need to figure out a way to signal
the thread to quit. I suggested 2 ways you might be able to signal the
thread to quit. I don't know of any other ways myself.
1.) You must have something writing to the socket you are reading from.
Use that 'something' to send a message to the reading socket that tells it
to quit. The reading socket will unblock because there is data ready.
When it reads the message telling it to quit, then quit.
2.) Instead of using a read that blocks until data is available, use a
read with a timeout. When you want the reading thread to quit, set some
type of flag saying you want to quit. In your reading thread, read until
the timeout is up, check the flag, quit if signaled to quit, otherwise
start another read with a timeout; repeat.
--
Mark Miesfeld
------------------------------------------------------------------------------
LogMeIn Central: Instant, anywhere, Remote PC access and management.
Stay in control, update software, and manage PCs from one command center
Diagnose problems and improve visibility into emerging IT issues
Automate, monitor and manage. Do more in less time with Central
http://p.sf.net/sfu/logmein12331_d2d
_______________________________________________
Oorexx-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/oorexx-users