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

[linrad] Re: Error exit



If you cancel a thread that has been started with default parameters, it will be cancelled either at a convenient point (such as when it attempts to acquire a mutex or semaphore) or at point of your own choosing, via pthread_testcancel().

Usually the threads are started from a main routine, which proceeds to do a pthread_join() for each of the threads it's started. When threads are cancelled they exit cleanly to the corresponding pthread_join() points.

One thing this means is that there probably needs to be a single thread whose task is to shut down the other threads. It alone does a pthread_exit() which returns to a pthread_join() point.

leif@xxxxxxxxxx wrote:
Hi All,

Linrad has error exits that end with exit(0).
In the multi-threaded version this does not work.
Killing all threads is difficult because at the point
where it should be done, the calling thread may kill itself, thereby leaving other threads running.

Presumably there is some kind of system call that
would stop all threads and make a proper exit but
I have not been able to find out how to do.

Is there anyone on this list who knows how to make
an exit routine that safely stops everything?
(Best a strategy that is platform independent.)


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>





#############################################################
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
n