* bug with DEC C++ exceptions and Pthreads
@ 1994-11-01 4:02 Mr Mike James Lijewski
1994-11-02 16:13 ` Tom Carlson
0 siblings, 1 reply; 2+ messages in thread
From: Mr Mike James Lijewski @ 1994-11-01 4:02 UTC (permalink / raw)
Script started on Mon Oct 31 08:43:20 1994
% uname -a
OSF1 bsr02 V3.0 358 alpha
% cat a.C
//
// This program illustrates that the C++ exception handling function
// terminate() is maintained on a per-process basis not a per-thread
// basis. This appears to contradict the intent of the Annotated C++
// Reference Manual. In particular, in the commentary in section 15.6c
// where both terminate() and unexpected() are talked about, we have the
// following statement:
//
// Note that these functions must be specific to individual threads in a
// multi-threaded program.
//
// Compile as:
//
// cxx a.C -lpthreads -lc_r -lmach
//
#include <stdlib.h>
#include <pthread.h>
#include <stdio.h>
#ifdef __DECCXX
#include <cxx_exception.h>
#endif
class X {};
static void main_terminate_handler ()
{
(void) printf("exiting via terminate_handler() set in main() ...\n");
exit(1);
}
static void thread_terminate_handler ()
{
(void) printf("exiting via terminate_handler() set in thread ...\n");
exit(1);
}
static void* work (pthread_addr_t ignore)
{
(void) printf("Setting terminate() in a thread ...\n");
set_terminate(thread_terminate_handler);
sleep(3);
(void) printf("Exiting the thread ...\n");
return 0;
}
main ()
{
(void) printf("Setting terminate() in main() ...\n");
set_terminate(main_terminate_handler);
pthread_t thread;
pthread_addr_t status;
if (pthread_create(&thread, pthread_attr_default, work, 0) < 0)
perror("pthread_create"), exit(1);
sleep(1);
(void) printf("throwing an exception in main() ...\n");
throw X();
(void) printf("Exiting main() ...\n");
return 0;
}
% cxx a.C -lpthreads -lc_r -lmach
% ./a.out
Setting terminate() in main() ...
Setting terminate() in a thread ...
throwing an exception in main() ...
exiting via terminate_handler() set in thread ...
script done on Mon Oct 31 08:43:57 1994
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: bug with DEC C++ exceptions and Pthreads
1994-11-01 4:02 bug with DEC C++ exceptions and Pthreads Mr Mike James Lijewski
@ 1994-11-02 16:13 ` Tom Carlson
0 siblings, 0 replies; 2+ messages in thread
From: Tom Carlson @ 1994-11-02 16:13 UTC (permalink / raw)
> // This program illustrates that the C++ exception handling function
> // terminate() is maintained on a per-process basis not a per-thread
> // basis. This appears to contradict the intent of the Annotated C++
> // Reference Manual. In particular, in the commentary in section 15.6c
> // where both terminate() and unexpected() are talked about, we have the
> // following statement:
Thanks, this does indeed appear to be a bug.
It's been entered in our internal bug list. We plan to address this and
other related issues in the near future...
Tom
--
Thomas Carlson, DEC C/DEC C++ carlson@decc.enet.dec.com
Digital Equipment Corporation, ZK2-3/N30
110 Spitbrook Rd,
Nashua, NH 03062
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~1994-11-02 16:13 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1994-11-01 4:02 bug with DEC C++ exceptions and Pthreads Mr Mike James Lijewski
1994-11-02 16:13 ` Tom Carlson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox