Permalink
Browse files

2000-07-25 Ross Johnson <rpj@special.ise.canberra.edu.au>

        * sched.c (sched_get_priority_max): Handle different WinCE and
        Win32 priority values together.
        (sched_get_priority_min): Ditto.
        - Tristan Savatier <tristan@mpegtv.com>

        * create.c (pthread_create): Force new threads to wait until
        pthread_create has the new thread's handle; we also retain
        a local copy of the handle for internal use until
        pthread_create returns.

        * private.c (_pthread_threadStart): Initialise ei[].
        (_pthread_threadStart): When beginthread is used to start the
        thread, force waiting until the creator thread had the
        thread handle.

        * cancel.c (_pthread_cancel_thread): Include context switch
        code for defined(_X86_) environments in addition to _M_IX86.

        * rwlock.c (pthread_rwlock_destroy): Assignment changed
        to avoid compiler warning.

        * private.c (_pthread_get_exception_services_code): Cast
        NULL return value to avoid compiler warning.

        * cleanup.c (pthread_pop_cleanup): Initialise "cleanup" variable
        to avoid compiler warnings.

        * misc.c (_pthread_new): Change "new" variable to "t" to avoid
        confusion with the C++ keyword of the same name.

        * condvar.c (cond_wait_cleanup): Initialise lastWaiter variable.
        (cond_timedwait): Remove unused local variables. to avoid
        compiler warnings.

        * dll.c (dllMain): Remove 2000-07-21 change - problem
        appears to be in pthread_create().

2000-07-22  Ross Johnson  <rpj@special.ise.canberra.edu.au>

        * tsd.c (pthread_key_create): If a destructor was given
        and the pthread_mutex_init failed, then would try to
        reference a NULL pointer (*key); eliminate this section of
        code by using a dynamically initialised mutex
        (PTHREAD_MUTEX_INITIALIZER).

        * tsd.c (pthread_setspecific): Return an error if
        unable to set the value; simplify cryptic conditional.

        * tsd.c (pthread_key_delete): Locking threadsLock relied
        on mutex_lock returning an error if the key has no destructor.
        ThreadsLock is only initialised if the key has a destructor.
        Making this mutex a static could reduce the number of mutexes
        used by an application since it is actually created only at
        first use and it's often destroyed soon after.

2000-07-22  Ross Johnson  <rpj@special.ise.canberra.edu.au>

        * FAQ: Added Q5 and Q6.


tests/ChangeLog:

2000-07-25  Ross Johnson  <rpj@special.ise.canberra.edu.au>

        * runtest.bat: modified to work under W98.

        * runall.bat: Add new tests; modified to work under W98.
        It was ok under NT.

        * Makefile: Add new tests.

        * exception1.c: New; Test passing exceptions back to the
        application and retaining library internal exceptions.

        * join0.c: New; Test a single join.
  • Loading branch information...
1 parent 55ce1e2 commit ec64b346c41c0669ba9b8a11524529dbf650fb9f rpj committed Jul 25, 2000
Showing with 695 additions and 337 deletions.
  1. +89 −1 ChangeLog
  2. +68 −0 FAQ
  3. +71 −69 GNUmakefile
  4. +9 −3 Makefile
  5. +2 −11 README.WinCE
  6. +20 −3 TODO
  7. +7 −2 attr.c
  8. +8 −6 cancel.c
  9. +13 −6 cleanup.c
  10. +1 −3 condvar.c
  11. +16 −0 config.h
  12. +16 −0 config.h.in
  13. +33 −11 create.c
  14. +6 −0 dll.c
  15. +1 −1 implement.h
  16. +8 −8 misc.c
  17. +27 −8 mutex.c
  18. +23 −11 private.c
  19. +22 −9 pthread.h
  20. +1 −1 rwlock.c
  21. +28 −2 sched.c
  22. +1 −1 signal.c
  23. +14 −0 tests/ChangeLog
  24. +5 −2 tests/Makefile
  25. +1 −2 tests/cancel2.c
  26. +2 −2 tests/cancel3.c
  27. +1 −1 tests/cancel4.c
  28. +9 −9 tests/ccl.bat
  29. +9 −4 tests/join1.c
  30. +1 −1 tests/loadfree.c
  31. +66 −64 tests/runall.bat
  32. +81 −69 tests/runtest.bat
  33. +36 −27 tsd.c
View
@@ -1,8 +1,64 @@
-2000-07-25 Ross Johnson <rpj@setup1.ise.canberra.edu.au>
+2000-07-25 Ross Johnson <rpj@special.ise.canberra.edu.au>
+
+ * sched.c (sched_get_priority_max): Handle different WinCE and
+ Win32 priority values together.
+ (sched_get_priority_min): Ditto.
+ - Tristan Savatier <tristan@mpegtv.com>
+
+ * create.c (pthread_create): Force new threads to wait until
+ pthread_create has the new thread's handle; we also retain
+ a local copy of the handle for internal use until
+ pthread_create returns.
+
+ * private.c (_pthread_threadStart): Initialise ei[].
+ (_pthread_threadStart): When beginthread is used to start the
+ thread, force waiting until the creator thread had the
+ thread handle.
+
+ * cancel.c (_pthread_cancel_thread): Include context switch
+ code for defined(_X86_) environments in addition to _M_IX86.
+
+ * rwlock.c (pthread_rwlock_destroy): Assignment changed
+ to avoid compiler warning.
+
+ * private.c (_pthread_get_exception_services_code): Cast
+ NULL return value to avoid compiler warning.
+
+ * cleanup.c (pthread_pop_cleanup): Initialise "cleanup" variable
+ to avoid compiler warnings.
+
+ * misc.c (_pthread_new): Change "new" variable to "t" to avoid
+ confusion with the C++ keyword of the same name.
+
+ * condvar.c (cond_wait_cleanup): Initialise lastWaiter variable.
+ (cond_timedwait): Remove unused local variables. to avoid
+ compiler warnings.
* dll.c (dllMain): Remove 2000-07-21 change - problem
appears to be in pthread_create().
+2000-07-22 Ross Johnson <rpj@special.ise.canberra.edu.au>
+
+ * tsd.c (pthread_key_create): If a destructor was given
+ and the pthread_mutex_init failed, then would try to
+ reference a NULL pointer (*key); eliminate this section of
+ code by using a dynamically initialised mutex
+ (PTHREAD_MUTEX_INITIALIZER).
+
+ * tsd.c (pthread_setspecific): Return an error if
+ unable to set the value; simplify cryptic conditional.
+
+ * tsd.c (pthread_key_delete): Locking threadsLock relied
+ on mutex_lock returning an error if the key has no destructor.
+ ThreadsLock is only initialised if the key has a destructor.
+ Making this mutex a static could reduce the number of mutexes
+ used by an application since it is actually created only at
+ first use and it's often destroyed soon after.
+
+2000-07-22 Ross Johnson <rpj@special.ise.canberra.edu.au>
+
+ * FAQ: Added Q5 and Q6.
+
2000-07-21 Ross Johnson <rpj@setup1.ise.canberra.edu.au>
* create.c (pthread_create): Set threadH to 0 (zero)
@@ -29,6 +85,38 @@
* signal.c (pthread_sigmask): return an error value if
pthread_self() returns NULL.
+2000-03-02 Ross Johnson <rpj@special.ise.canberra.edu.au>
+
+ * attr.c (pthread_attr_init): Set default stacksize to zero (0)
+ rather than PTHREAD_STACK_MIN even though these are now the same.
+
+ * pthread.h (PTHREAD_STACK_MIN): Lowered to 0.
+
+2000-01-28 Ross Johnson <rpj@special.ise.canberra.edu.au>
+
+ * mutex.c (pthread_mutex_init): Free mutex if it has been alloced;
+ if critical sections can be used instead of Win32 mutexes, test
+ that the critical section works and return an error if not.
+
+2000-01-07 Ross Johnson <rpj@special.ise.canberra.edu.au>
+
+ * cleanup.c (pthread_pop_cleanup): Include SEH code only if MSC is not
+ compiling as C++.
+ (pthread_push_cleanup): Include SEH code only if MSC is not
+ compiling as C++.
+
+ * pthread.h: Include SEH code only if MSC is not
+ compiling as C++.
+
+ * implement.h: Include SEH code only if MSC is not
+ compiling as C++.
+
+ * cancel.c (_pthread_cancel_thread): Add _M_IX86 check.
+ (pthread_testcancel): Include SEH code only if MSC is not
+ compiling as C++.
+ (_pthread_cancel_self): Include SEH code only if MSC is not
+ compiling as C++.
+
2000-01-06 Ross Johnson <rpj@special.ise.canberra.edu.au>
* Makefile: Remove inconsistencies in 'cl' args
View
68 FAQ
@@ -14,6 +14,10 @@ Q 3 How do I use pthread.dll for Win32 (Visual C++ 5.0)
Q 4 Cancelation doesn't work for me, why?
+Q 5 Thread won't block after two calls to mutex_lock
+
+Q 6 How do I generate libpthread.a for use with Mingw32?
+
=============================================================================
Q 1 Should I use Cygwin or Mingw32 as a development environment?
@@ -253,3 +257,67 @@ a thread is going to block on a Win32 handle. These are:
Regards.
Ross
+------------------------------------------------------------------------------
+
+Q 5 Thread won't block after two calls to mutex_lock
+---
+
+A 5
+---
+
+> i was testing this pthread for win32 in my prog.
+> when i checked if it was blocking mutex_lock calls, i was surprised when it
+> didnt lock
+>
+> pthread_mutex_t DBlock;
+>
+> pthread_mutex_init( &DBlock, NULL );
+> pthread_mutex_lock( &DBlock );
+> pthread_mutex_lock( &DBlock );
+>
+> ^^ these two calls didnt block
+
+POSIX leaves the result "undefined" for a thread that tries
+to recursively lock the same mutex (one that it owns already).
+That means the actual semantics are left up to the
+implementation, but should not be relied upon for code that
+will be ported to different POSIX threads implementations.
+
+In the pthreads-win32 implementation a thread won't deadlock
+itself by relocking the mutex. Subsequent calls to
+pthread_mutex_lock() as in your example above increment
+the lock count but the thread continues on. Consequently,
+the thread must ensure that it unlocks the mutex once for
+each lock operation. That is, pthreads-win32 mutexes are
+always recursive.
+
+You may want to look at the other synchronisation devices
+available in the library, such as condition variables or
+read-write locks.
+
+Ross
+
+------------------------------------------------------------------------------
+
+Q 6 How do I generate libpthread.a for use with Mingw32?
+---
+
+A 6
+---
+
+> I'm lacking the libpthread.a that
+> used to come with the pre-compiled package. The last time this
+> library appeared was in 1999-08-12. Without this library I cannot
+> use the pre-compiled dll.
+
+You can create libpthread.a from the .def file, should work along these
+lines:
+
+$(DLLTOOL) --as $(AS) -k --dllname libpthread.dll --output-lib
+libpthread.a --def $(srcdir)/libpthread.def
+
+Where DLLTOOL is i686-pc-cygwin-dlltool
+and AS i686-pc-cygwin-as.
+
+Thomas Sailer <sailer@ife.ee.ethz.ch>
+
View
@@ -1,69 +1,71 @@
-#
-# Pthreads-win32 - POSIX Threads Library for Win32
-# Copyright (C) 1998
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Library General Public
-# License as published by the Free Software Foundation; either
-# version 2 of the License, or (at your option) any later version.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Library General Public License for more details.
-#
-# You should have received a copy of the GNU Library General Public
-# License along with this library; if not, write to the Free
-# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
-# MA 02111-1307, USA
-#
-
-RM = erase
-
-CC = g++
-
-AR = ar
-
-LD = gcc -mdll
-
-OPT = -g -O2
-
-## Mingw32
-CFLAGS = $(OPT) -I. -DHAVE_CONFIG_H -Wall
-
-## Cygwin G++
-#CFLAGS = $(OPT) -fhandle-exceptions -I. -DHAVE_CONFIG_H -Wall
-
-OBJS = attr.o cancel.o cleanup.o condvar.o create.o dll.o errno.o \
- exit.o fork.o global.o misc.o mutex.o private.o rwlock.o \
- sched.o semaphore.o signal.o sync.o tsd.o
-
-INCL = implement.h semaphore.h pthread.h windows.h
-
-DLL = pthread.dll
-
-LIB = libpthread32.a
-
-
-all: $(LIB)
-
-$(LIB): $(DLL)
- dlltool --def $(DLL:.dll=.def) --output-lib $@ --dllname $(DLL)
-
-.SUFFIXES: .dll
-
-$(DLL): $(OBJS)
- $(LD) -o $@ $^ -Wl,--base-file,$*.base
- dlltool --base-file=$*.base --def $*.def --output-exp $*.exp --dllname $@
- $(LD) -o $@ $^ -Wl,--base-file,$*.base,$*.exp
- dlltool --base-file=$*.base --def $*.def --output-exp $*.exp --dllname $@
- $(LD) -o $@ $^ -Wl,$*.exp
-
-clean:
- -$(RM) *~
- -$(RM) $(LIB)
- -$(RM) *.o
- -$(RM) *.exe
- -$(RM) $(DLL)
- -$(RM) $(DLL:.dll=.base)
- -$(RM) $(DLL:.dll=.exp)
+#
+# Pthreads-win32 - POSIX Threads Library for Win32
+# Copyright (C) 1998
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Library General Public
+# License as published by the Free Software Foundation; either
+# version 2 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Library General Public License for more details.
+#
+# You should have received a copy of the GNU Library General Public
+# License along with this library; if not, write to the Free
+# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+# MA 02111-1307, USA
+#
+
+GLANG = c++
+
+RM = erase
+
+CC = gcc
+
+AR = ar
+
+LD = gcc -mdll
+
+OPT = -g -O2 -x $(GLANG)
+
+## Mingw32
+CFLAGS = $(OPT) -I. -DHAVE_CONFIG_H -Wall
+
+## Cygwin G++
+#CFLAGS = $(OPT) -fhandle-exceptions -I. -DHAVE_CONFIG_H -Wall
+
+OBJS = attr.o cancel.o cleanup.o condvar.o create.o dll.o errno.o \
+ exit.o fork.o global.o misc.o mutex.o private.o rwlock.o \
+ sched.o semaphore.o signal.o sync.o tsd.o
+
+INCL = implement.h semaphore.h pthread.h windows.h
+
+DLL = pthread.dll
+
+LIB = libpthread32.a
+
+
+all: $(LIB)
+
+$(LIB): $(DLL)
+ dlltool --def $(DLL:.dll=.def) --output-lib $@ --dllname $(DLL)
+
+.SUFFIXES: .dll
+
+$(DLL): $(OBJS)
+ $(LD) -o $@ $^ -Wl,--base-file,$*.base
+ dlltool --base-file=$*.base --def $*.def --output-exp $*.exp --dllname $@
+ $(LD) -o $@ $^ -Wl,--base-file,$*.base,$*.exp
+ dlltool --base-file=$*.base --def $*.def --output-exp $*.exp --dllname $@
+ $(LD) -o $@ $^ -Wl,$*.exp
+
+clean:
+ -$(RM) *~
+ -$(RM) $(LIB)
+ -$(RM) *.o
+ -$(RM) *.exe
+ -$(RM) $(DLL)
+ -$(RM) $(DLL:.dll=.base)
+ -$(RM) $(DLL:.dll=.exp)
View
@@ -11,7 +11,9 @@ DEVROOT=e:
DLLDEST=$(DEVROOT)\dll
LIBDEST=$(DEVROOT)\lib
-CLIB=/MD
+#CLIB = /MD
+CLIB = /MT
+CFLAGS = #/EHsc /TP
OBJ=attr.obj \
cancel.obj \
@@ -46,10 +48,14 @@ install: all
copy pthread.lib $(LIBDEST)
pthread.dll: $(OBJ) pthread.def
- cl /LDd /Zi $(CLIB) $(OBJ) /Fepthread.dll pthread.def
+ cl /LD /Zi $(CFLAGS) $(OBJ) /Fepthread.dll /link \
+ /nodefaultlib:libcmt \
+ /implib:pthread.lib \
+ msvcrt.lib \
+ /def:pthread.def
.c.obj::
- cl /W3 $(CLIB) /nologo /Yd /Zi /I. \
+ cl /W3 $(CLIB) $(CFLAGS) /nologo /Yd /Zi /I. \
/D_WIN32_WINNT=0x400 \
/DSTDCALL=_stdcall \
-c $<
View
@@ -2,14 +2,5 @@ WinCE port
----------
(See the file WinCE-PORT for a detailed explanation.)
-In config.h:
-
-you need to define the following which are undefined by default:
-
-#define NEED_DUPLICATEHANDLE
-#define NEED_CREATETHREAD
-#define NEED_ERRNO
-#define NEED_CALLOC
-#define NEED_FTIME
-#define NEED_SEM
-
+Make sure you define "WINCE" amongst your compiler flags (eg. -DWINCE).
+The config.h file will define all the necessary defines for you.
View
23 TODO
@@ -1,3 +1,20 @@
-- Check behaviour of calling pthread_exit from main().
- The main thread should wait for other threads to exit
- before calling exit.
+====
+Automate the build/test cycle so that I can
+expand to test both library and applications in different
+environments and cross-environments.
+
+Eg.
+ Applications | SEH | C++ | G++ | C | GCC |
+ Library | | | | | |
+ ----------------+-----+-----+-----+-----+-----+
+ SEH | X | X | X | X | X |
+ ----------------+-----+-----+-----+-----+-----+
+ C++ (MSC) | X | X | X | X | X |
+ ----------------+-----+-----+-----+-----+-----+
+ G++ (GNU) | ? | ? | X | ? | X |
+ ----------------+-----+-----+-----+-----+-----+
+
+'?' indicates combinations that may not be doable.
+
+====
+
Oops, something went wrong.

0 comments on commit ec64b34

Please sign in to comment.