This is the mail archive of the cygwin-developers@sourceware.cygnus.com mailing list for the Cygwin project. See the Cygwin home page for more information.
[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index] [Subject Index] [Author Index] [Thread Index]

Re: b20.1 (egcs-1.1.1): making winsup problem



On Mon, 15 Feb 1999, Stipe Tolj wrote:

> 
> Now I'm ready to go ahead in trying to get pthreads running. Geoffrey mentioned
> that the latest winsup snapshot supports a configure options caleld
> --enablethreadsafe to support at least experimental thread support.
> 
> Will this include and build the pthread package or will I have to compile it from
> the pthread-win32 package available at sourceware.cygnus.com?
> 
> The latest pthreads-snap-1999-01-23 claims within README to be unable to compile
> under Cygwin or Mingw. I have compiled successfully the older
> pthreads-snap-10-20, but when linking the example programs I get undefined
> references to _beginthreadex and _endthreadex, which obviously are not supported
> on Win9x systems.

There is now a workaround so that _begin/endthreadex is emulated with
CreateThread.

> 
> May you have a clue how to get basic pthread support for Cygwin, if possible?
> 

I don't know much about the pthreads-win32 project, but I do that the
current CVS version doesn't build correctly. I'm attaching a trivial patch
that you may want to try out. It builds, but I haven't done any testing on
it. I'm afraid I can't be of any more help than this.

> What do you mean with an object directory? In other words: Where is the
> difference in a source and object directory within this scope?

GNU configure allows building in a directory different than the source,
and more and more packages are actually specifying that you do so to avoid
certain problems (eg., egcs recommends this).

Let's say the source directory for package foo is /usr/local/src/foo. I
usually create a foo-build directory somewhere else and then run configure
from within this foo-build, ie., the build directory. 

Regards,
Mumit

ps: I can't post to cygwin-developers, so you could you post forward my
response if you think it's relevant?

Index: implement.h
===================================================================
RCS file: /cvs/pthreads-win32/pthreads/implement.h,v
retrieving revision 1.43
diff -u -3 -p -r1.43 implement.h
--- implement.h	1999/02/09 14:59:17	1.43
+++ implement.h	1999/02/15 16:43:15
@@ -211,7 +211,7 @@ int _pthread_sem_post (_pthread_sem_t * 
  *
  * Patch by Anders Norlander <anorland@hem2.passagen.se>
  */
-#if defined(__CYGWIN32__) || defined(__CYGWIN__)
+#if defined(__CYGWIN32__) || defined(__CYGWIN__) || defined(__MINGW32__)
 
 /* 
  * Macro uses args so we can cast start_proc to LPTHREAD_START_ROUTINE
@@ -233,7 +233,7 @@ int _pthread_sem_post (_pthread_sem_t * 
 
 #define _endthreadex ExitThread
 
-#endif /* __CYGWIN32__ || __CYGWIN__ */
+#endif /* __CYGWIN32__ || __CYGWIN__ || __MINGW32__ */
 
 
 #endif /* _IMPLEMENT_H */
Index: pthread.h
===================================================================
RCS file: /cvs/pthreads-win32/pthreads/pthread.h,v
retrieving revision 1.58
diff -u -3 -p -r1.58 pthread.h
--- pthread.h	1999/02/12 08:19:38	1.58
+++ pthread.h	1999/02/15 16:43:17
@@ -252,7 +252,7 @@ struct timespec {
 
 /* #include <sched.h> */
 
-#ifdef __MINGW32__
+#if defined (__MINGW32__) || defined (__CYGWIN__)
 #define PT_STDCALL
 #else
 #define PT_STDCALL __stdcall
@@ -263,7 +263,7 @@ struct timespec {
  * possibly fixed in Mingw32 to
  * correspond to the Windows headers.
  */
-#ifdef __MINGW32__
+#if defined (__MINGW32__) || defined (__CYGWIN__)
 #define _timeb timeb
 #endif
 
@@ -632,10 +632,12 @@ struct pthread_condattr_t_ {
 };
 
 
+#if 0
 struct pthread_once_t_ {
   unsigned short flag;
   pthread_mutex_t lock;
 };
+#endif
 
 
 /*
Index: semaphore.c
===================================================================
RCS file: /cvs/pthreads-win32/pthreads/semaphore.c,v
retrieving revision 1.8
diff -u -3 -p -r1.8 semaphore.c
--- semaphore.c	1999/02/08 21:19:59	1.8
+++ semaphore.c	1999/02/15 16:43:18
@@ -258,11 +258,7 @@ _pthread_sem_timedwait (_pthread_sem_t *
       * ------------------------------------------------------
       */
 {
-#if defined(__MINGW32__)
-  struct timeb currSysTime;
-#else
   struct _timeb currSysTime;
-#endif
   const DWORD NANOSEC_PER_MILLISEC = 1000000;
   const DWORD MILLISEC_PER_SEC = 1000;
   DWORD milliseconds;