This is the mail archive of the email@example.com mailing list for the pthreads-win32 project. See the pthreads-win32 home page for more information.
Hi John, The package uses your code verbatim apart from the additions to check TryEnterCriticalSection. As I mentioned, the key cleanup for the primary thread works fine on NT. The test calls pthread_key_destroy before it exits, and then checks that the local destroy_key routine is called for each thread including the primary thread. An earlier test simply included a printf inside of destroy_key and left cleanup to DllMain. The problem I'm seeing on Win98 was the motivation for attempting to take direct control and calling pthread_key_destroy. I think the GetLastError always returning error number 120 in the primary thread is strange. Do I interpret that as meaning that GetLastError is unsupported? (It would only be unsupported in the primary thread it seems.) Makes me wonder what else behaves differently there, and in particular, whether there is some methodology that is meant to be applied when writing primary thread code. Anyone? Ross On Tue, 23 Feb 1999, Bossom, John wrote: > Hi Ross, > > My original code should have been explicitly destroying the > main thread when the DLL terminates through the use of DllMain > when the DLL_PROCESS_DETACH is received (DLL_THREAD_DETACH for > all others). > > Beware that, for DllMain, you don't get a DLL_THREAD_ATTACH > DLL_THREAD_DETACH for the main thread; only a DLL_PROCESS_ATTACH > DLL_PROCESS_DETACH. > > -----Original Message----- > From: Ross Johnson [mailto:firstname.lastname@example.org] > Sent: Tuesday, February 23, 1999 5:29 PM > To: POSIX threads on Win32 > Subject: RE: TryEnterCriticalSection on Win98 > > > I'm probably the only one who would be confused by what I wrote > below, but just to clarify: > > > Now, all this seems to fit with other observations, namely when I > > run the tsd1.c test, which creates and destroys TSD keys, I was > > finding that on Win98 the pthread_destroy() was not being called for > > the main thread key. The test runs fine on WNT. > > pthread_destroy !? What am I saying? I meant to say that the > destroy_key routine (supplied to pthread_key_create) was not being > called for the main thread. > > > > > Soooo, the obvious question now is, is there actually a "main > > thread" on Win98? A second obvious question is, how come there > > aren't thousands of applications breaking on Win98? I MUST be > > missing something. > > > > Ross > > +----------------------+---+ > | Ross Johnson | | E-Mail: email@example.com > | Info Sciences and Eng|___| > | University of Canberra | FAX: +61 6 2015227 > | PO Box 1 | > | Belconnen ACT 2616 | WWW: http://willow.canberra.edu.au/~rpj/ > | AUSTRALIA | > +--------------------------+ > > +----------------------+---+ | Ross Johnson | | E-Mail: firstname.lastname@example.org | Info Sciences and Eng|___| | University of Canberra | FAX: +61 6 2015227 | PO Box 1 | | Belconnen ACT 2616 | WWW: http://willow.canberra.edu.au/~rpj/ | AUSTRALIA | +--------------------------+