|
Boost : |
From: Alexander Terekhov (TEREKHOV_at_[hidden])
Date: 2002-08-12 12:22:51
Dale Peakall (dale.peakall_at_[hidden]) wrote:
[...]
> Most C libraries have problems with exception-safety in C++,
> because the concept doesn't exist in C.
Well, obviously [and "to begin with"], you've never heard of
things along the lines of "#include <pthread_exception.h>"...
spe207.testdrive.compaq.com> what /shlib/libpthread.so|grep DECthreads
DECthreads version V3.18-138 May 12 2002
spe207.testdrive.compaq.com> cc -pthread -o ceh ceh.c
spe207.testdrive.compaq.com> ./ceh
Go...
Hi There! Greetings from the ``yellow zone.''
Exception: Attempted stack overflow was detected (dce / thd)
Indeed. ;-)
spe207.testdrive.compaq.com> cat ceh.c
#include <stdio.h>
#include <memory.h>
#include <pthread.h>
#include <pthread_exception.h>
void operation()
{
char buffer[128];
memset( buffer, 0, sizeof( buffer ) );
operation();
}
void* my_thread( void* p )
{
TRY {
printf( "\nGo...\n\n" );
operation();
}
CATCH_ALL {
printf( "Hi There! Greetings from the ``yellow zone.''\n\n" );
pthread_exc_report_np( THIS_CATCH );
TRY {
RERAISE;
}
CATCH( pthread_stackovf_e ) {
printf( "\nIndeed. ;-)\n\n" );
}
ENDTRY
}
ENDTRY
return NULL;
}
int main()
{
pthread_t tid;
pthread_create( &tid, NULL, &my_thread, NULL );
pthread_exit( NULL );
}
regards,
alexander.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk