This is the mail archive of the
newlib@sources.redhat.com
mailing list for the newlib project.
[robert.collins@itdomain.com.au: Pthread support in cygwin]
- To: newlib at sources dot redhat dot com
- Subject: [robert.collins@itdomain.com.au: Pthread support in cygwin]
- From: Christopher Faylor <cgf at redhat dot com>
- Date: Wed, 11 Apr 2001 20:13:25 -0400
----- Forwarded message from Robert Collins <robert.collins@itdomain.com.au> -----
From: "Robert Collins" <robert.collins@itdomain.com.au>
To: <newlib-patches@sources.redhat.com>, <cygwin-patches@cygwin.com>
Subject: Pthread support in cygwin
Date: Thu, 12 Apr 2001 09:59:24 +1000
This patch and attached changelog (my mailer stuffs up the formatting)
are a resubmission of the previosuly discussed patches for pthreads &
cygwin in newlib. I will look into a larger rearrangement as
discussed... but that will be much later. I won't shed any tears if the
rtems folk get there first :]
This patch is self-contained: committing it now should not cause any
problems with the existing pthread support in cygwin. (However I haven't
tried to mix and match so...)
==
2001-04-12 Robert Collins <rbtcollins@hotmail.com>
* libc/include/sys/features.h: Add appropriate defines for Cygwin
pthread support.
* libc/include/sys/signal.h: Remove unneeded __CYGWIN__ protection.
* libc/include/sys/types.h: Protect __CYGWIN__ from the rtems pthreads
types.
Include <cygwin/types.h> for the cygwin specific typedefs.
----- End forwarded message -----
? .pthread.ChangeLog.swp
? pthread.ChangeLog
? pthread.patch
Index: libc/include/sys/features.h
===================================================================
RCS file: /cvs/src/src/newlib/libc/include/sys/features.h,v
retrieving revision 1.2
diff -u -p -r1.2 features.h
--- features.h 2001/01/12 02:41:33 1.2
+++ features.h 2001/04/11 23:51:41
@@ -81,6 +81,11 @@ extern "C" {
# define _POSIX_JOB_CONTROL 1
# define _POSIX_SAVED_IDS 0
# define _POSIX_VERSION 199009L
+# define _POSIX_THREADS 1
+# define _POSIX_THREAD_PROCESS_SHARED 1
+# define _POSIX_THREAD_SAFE_FUNCTIONS 1
+# define _POSIX_THREAD_PRIORITY_SCHEDULING 1
+# define _POSIX_THREAD_ATTR_STACKSIZE 1
#endif
#ifdef __cplusplus
Index: libc/include/sys/signal.h
===================================================================
RCS file: /cvs/src/src/newlib/libc/include/sys/signal.h,v
retrieving revision 1.7
diff -u -p -r1.7 signal.h
--- signal.h 2001/02/15 06:42:35 1.7
+++ signal.h 2001/04/11 23:52:03
@@ -12,7 +12,7 @@ extern "C" {
/* #ifndef __STRICT_ANSI__*/
-#if defined(_POSIX_THREADS) || defined(__CYGWIN__)
+#if defined(_POSIX_THREADS)
#include <sys/types.h> /* for pthread data types */
#endif
Index: libc/include/sys/types.h
===================================================================
RCS file: /cvs/src/src/newlib/libc/include/sys/types.h,v
retrieving revision 1.6
diff -u -p -r1.6 types.h
--- types.h 2001/03/20 19:27:56 1.6
+++ types.h 2001/04/11 23:52:04
@@ -206,7 +206,7 @@ typedef struct _types_fd_set {
condition variables, and keys. But since RTEMS is currently the only
newlib user of these, the ifdef is just on RTEMS. */
-#if defined(__rtems__)
+#if defined(__rtems__) || defined(__CYGWIN__)
#ifndef __clockid_t_defined
typedef _CLOCKID_T_ clockid_t;
@@ -220,8 +220,16 @@ typedef _TIMER_T_ timer_t;
#include <sys/features.h>
-#if defined(_POSIX_THREADS)
+/* Cygwin will probably never have full posix compliance due to little things
+ * like an inability to set the stackaddress. Cygwin is also using void *
+ * pointers rather than structs to ensure maximum binary compatability with
+ * previous releases.
+ * This means that we don't use the types defined here, but rather in
+ * <cygwin/types.h>
+ */
+#if defined(_POSIX_THREADS) && !(__CYGWIN__)
+
#include <sys/sched.h>
/*
@@ -313,7 +321,10 @@ typedef struct {
int is_initialized; /* is this structure initialized? */
int init_executed; /* has the initialization routine been run? */
} pthread_once_t; /* dynamic package initialization */
-
+#else
+#if defined (__CYGWIN__)
+#include <cygwin/types.h>
+#endif
#endif /* defined(_POSIX_THREADS) */
#endif /* defined(__rtems__) */