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]

About exit4.c

I am using the cvs of pthreads downloaded the 2002-02-23 [09:00am]

I tried to find the reason of the problem with test\exit4.c
Essentially, as you know, is the fact that when an exception is thrown
and the stack is unwound the destructor of an object allocated in the
stack is not called even if the object is destroyed (I don't see any
memory leak).

I found some interesting results:

1) If  throw ptw32_exception_exit(); or  pthread_exit(arg); is called
from within func() in the module exit4.h, that the destructor IS called

2) If pthread_exit() is called from within an auxiliary function inside
exit.c, where also pthread_exit() is, than the destructor is still NOT

3) If an object is declared in thread.h (as I did with
pthread_CheckDestructor) ad instantiated inside func() in exit4.c (like
the Guard object),  than its destructor IS called.

4) If I compile exit4.c and pthread.c together (so I don't use any
library, either static or dynamic) than the behaviour above doesn't
So the problem is not due to some DLL's address space issues.

5) Compiling with icl5 and icl6 (Intel compiler) the problem does not
exist in any case.

6) If the obj files are created by the Intel compiler, but directly
linked by the linker of Visual studio (link.exe), than the problem does
not exist in any case.
(to verify this I created the batch files tc.bat and tl.bat)

I tried to find some workarounds but I couldn't, maybe you can do it
with these informations.

I created some dsp projects (Visual Studio 6) and vjproj (Visual Studio
solutions) to make my life easier.
pthreads_dll.dsp, pthreads_lib.dsp to create a dynamic and a static

I also slightly modified the makefiles in order to easily switch between
the Microsoft compiler (vc) and the Intel compiler (icl).

I am sending as attachment the zip files used for this testing.
I am available for any further clarifications.

Best Regards,

While compiling the library there is a warning:
: warning C4297: 'ptw32_threadStart' : function assumed not to throw an
exception but does
        __declspec(nothrow) or throw() was specified on the function
but I don't know why is created and why only compiling private.c

Attachment: pthreads-2002-02-23 [09&00am]
Description: application/unknown-content-type-bitzipper

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