[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[linrad] Re: Error exit (and multi-platform)



> > The thing is that the expected event might never happen
> > because the error condition might be within the device driver. 
> > (or the mouse/keyboard is not touched.) I need the thread to 
> > become killed anyway.
> 
> It's almost always possible to ensure this doesn't happen 
> asynchronously. See below.
> 
> > OK. I understand this to be fine under normal conditions
> > but under error conditions some threads might not reach any 
> > suitable point - that is why they are CANCEL_ASYNCHRONOUS.
> > 
> > Normal thread exit is by a return to a join from where the
> > thread is created because each thread loop is a 
> > {
> > while(flag)
> >   {
> >   code
>      pthread_testcancel();  <<<<<
> >   }
> > return;
> > }
Sure - under normal conditions.
My problem is that "code" has failed for one reason or another
so "code" is unreliable.

> Also, it's quite rare that an execution loop in a thread is 
> free-running. Usually it is triggered or synchronized by 
> something, whether a semphore or a read or a sleep. These 
> would be the classical places for deferred cancellation to 
> be tested and to take effect.
Yes, I understand, but it is completely irrelevant where
execution stops under fatal error conditions so I stay
with ASYNCHRONOUS.

Normal stop is by setting "flag" to zero:-)

> If it's the case that the code can get wedged, such that it 
> can't get to a cancellation point, then there's probably no 
> recourse but to take down the entire process anyway.
Yes. The decision has already been taken and the error messages
have been saved by the thread that detected the fatal error.....

> 
> You can get the same effect by sending a signal to yourself:
> 	kill(0, SIGINT);
> This is really all the terminal driver is doing with Ctrl-C 
> -- it sees that character come in, and sends a SIGINT to its 
> own process group.
This was exactly what I was asking for:-)

Now I already implemented the error exit based on your
previous hints and it works fine so I will leave it as
it is. Someone else might want to add other threads
with disk activities that he wants to be killed
more nicely:-)

 
> > Can I compile a .EXE file for Windows 2000 with GCC under
> > Linux? What about Mackintosch?
> 
> You can certainly cross-compile, but it would be easier to 
> build the Windows EXE using Cygwin. Likewise, Mac OSX *is* 
> Unix with a lot of layers on top, very good ones to be sure. 
> Any port to a current Mac would be fairly straightforward.

Cygwin has to be run under Windows as far as I understand.
I am very sceptic to "development environments" under
graphical user interfaces. I have seen a little of others
(not so skilled) being very inefficient compared to what
I am used to in terminal mode under Linux. (Before Linux
I was using MSDOS for any programming work I did.)

Since I do not want to use the standard windows because they 
waste too much screen space I need only the few functions I 
listed in my previous mail. I will wait for someone else to
supply them. Otherwise someone else may port to other
platforms by whatever means they find suitable.

It would be nice to have a Makefile under Linux that would
output executables automatically for several platforms;-)

73

Leif / SM5BSZ


#############################################################
This message is sent to you because you are subscribed to
  the mailing list <linrad@xxxxxxxxxxxxxxxxxxxxx>.
To unsubscribe, E-mail to: <linrad-off@xxxxxxxxxxxxxxxxxxxxx>
To switch to the DIGEST mode, E-mail to <linrad-digest@xxxxxxxxxxxxxxxxxxxxx>
To switch to the INDEX mode, E-mail to <linrad-index@xxxxxxxxxxxxxxxxxxxxx>
Send administrative queries to  <linrad-request@xxxxxxxxxxxxxxxxxxxxx>
LINRADDARNIL
l