This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin 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: [PATCH] Modified pthread types; From: cygwin-patches@cygwin.com


> From: Thomas Pfaff 
> To: cygwin-patches.cygwin.com 

http://cygwin.com/ml/cygwin-patches/2002-q3/msg00052.html

>
> I have attached a patch with modified (dummy) pthread typedefs.
>
> This should give the compiler a chance to do some type validations,
> for example:
>
> pthread_t t;
> pthread_create(t,...) //wrong
> pthread_create(&t,...) // right
>
> pthread_cancel(t) //right
> pthread_cancel(&t)//wrong


Using your patch I needed to tweak /usr/include/pthreads.h
when compiling libstdc++.  Also I don't think that I saw a
memory leak when running your test program from the
cygwin-patch mailing list.

http://cygwin.com/ml/cygwin-patches/2002-q2/msg00214.html

Note I linked the CYGWIN dll to the gcc libraries generated
by a pthreads + exception enabled compile.
 

/Christoph


--- /usr/include/pthread.h.old	2002-07-04 17:01:18.000000000 +0200
+++ /usr/include/pthread.h	2002-07-05 20:48:12.000000000 +0200
@@ -44,7 +44,7 @@
 #define PTHREAD_CANCEL_DISABLE 1
 #define PTHREAD_CANCELED ((void *)-1)
 /* this should be a value that can never be a valid address */
-#define PTHREAD_COND_INITIALIZER (void *)21
+#define PTHREAD_COND_INITIALIZER (pthread_mutex_t)21
 #define PTHREAD_CREATE_DETACHED 1
 /* the default : joinable */
 #define PTHREAD_CREATE_JOINABLE 0
@@ -54,7 +54,7 @@
 #define PTHREAD_MUTEX_ERRORCHECK 1
 #define PTHREAD_MUTEX_NORMAL 2
 /* this should be too low to ever be a valid address */
-#define PTHREAD_MUTEX_INITIALIZER (void *)20
+#define PTHREAD_MUTEX_INITIALIZER (pthread_mutex_t)20
 #define PTHREAD_MUTEX_RECURSIVE 0
 #define PTHREAD_ONCE_INIT { PTHREAD_MUTEX_INITIALIZER, 0 }
 #define PTHREAD_PRIO_INHERIT


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


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