This is the mail archive of the mailing list for the pthreas-win32 project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: pthreads VCE: problem with destructor

> > This is exactly the reason why i have created the
> > setjmp/longjmp version.
> I am really puzzled. Since there is no standard
> PTHREAD C++ bindings that would guarantee things
> such as C++ tack unwinding on thread exit/
> cancellation, any C++ threaded written to exploit
> such things is NOT truly portable. However, there
> is practically no way to make thread cancellation/
> exit work in C++ programs using setjmp/longjmp
> because the C++ standard restricts the LEGAL
> usage of longjmp in *C++* programs:
> ISO/IEC 14882:1998(E), Pg 347:
> "The function signature longjmp(jmp_buf jbuf, int val)
>  has more restricted behavior in this International
>  Standard. If any automatic objects would be destroyed
>  by a thrown exception transferring control to another
>  (destination) point in the program, then a call to
>  longjmp( jbuf, val) at the throw point that transfers
>  control to the same (destination) point has
>  undefined behavior."
>  ^^^^^^^^^^^^^^^^^^
> regards,
> alexander.

Please do not take my comments out of the context. The original text was

> Regardless as Mr. Bossom so well has already stated: I certainly
> wouldn't
> depend on pthread_exit() or pthread_cancel() allowing destructors to run
> to be
> portable though.  Since the primary purpose of this library is to
> enhance
> portability of programs using pthreads, counting on pthread_exit() or
> pthread_cancel() to work in a non-portable way seems self-defeating.

This is exactly the reason why i have created the setjmp/longjmp version.
There may be bugs in it but i think they could be discovered if more would
using it.

I do not wanted the destructors to be run because this is nonportable.
Before the setjmp/longjmp code the only working implementation for
mingw32 was the c++ one that i disliked.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]