From 0103da82bdf86764129c3b1e57c0496af1bb91ab Mon Sep 17 00:00:00 2001 From: rpj Date: Sat, 29 May 1999 06:44:29 +0000 Subject: ./ChangeLog Sat May 8 09:42:30 1999 Ross Johnson * pthread.def (sem_open): Add. (sem_close): Add. (sem_unlink): Add. (sem_getvalue): Add. * FAQ (Question 3): Add. Thu Apr 8 01:16:23 1999 Ross Johnson * semaphore.c (sem_open): New function; returns an error (ENOSYS). (sem_close): ditto. (sem_unlink): ditto. (sem_getvalue): ditto. * semaphore.h (_POSIX_SEMAPHORES): define. ./tests/ChangeLog Sat May 29 23:29:04 1999 Ross Johnson * runall.bat (condvar5): Add new test. * runall.bat (condvar6): Add new test. * Makefile (condvar5) : Add new test. * Makefile (condvar6) : Add new test. * condvar5.c: New test for pthread_cond_broadcast(). * condvar6.c: New test for pthread_cond_broadcast(). --- ANNOUNCE | 6 +++++- ChangeLog | 18 ++++++++++++++++++ FAQ | 40 ++++++++++++++++++++++++++++++++++++++++ condvar.c | 5 +---- pthread.def | 6 +++++- semaphore.c | 33 +++++++++++++++++++++++++++++++++ semaphore.h | 19 +++++++++++++++++++ tests/ChangeLog | 14 ++++++++++++++ tests/Makefile | 5 ++++- tests/runall.bat | 2 ++ 10 files changed, 141 insertions(+), 7 deletions(-) diff --git a/ANNOUNCE b/ANNOUNCE index 8f702f6..187ddcb 100644 --- a/ANNOUNCE +++ b/ANNOUNCE @@ -1,5 +1,5 @@ - PTHREADS-WIN32 SNAPSHOT 1999-04-07 + PTHREADS-WIN32 SNAPSHOT 1999-05-08 ---------------------------------- Web Site: http://sourceware.cygnus.com/pthreads-win32/ FTP Site: ftp://sourceware.cygnus.com/pub/pthreads-win32 @@ -133,6 +133,10 @@ The following functions are implemented: sem_post (POSIX 1b) sem_wait (POSIX 1b) sem_trywait (POSIX 1b) + sem_open (POSIX 1b - returns an error) + sem_close (POSIX 1b - returns an error) + sem_unlink (POSIX 1b - returns an error) + sem_getvalue (POSIX 1b - returns an error) --------------------------- RealTime Scheduling diff --git a/ChangeLog b/ChangeLog index ddfb3ce..7e73b62 100644 --- a/ChangeLog +++ b/ChangeLog @@ -15,6 +15,24 @@ Fri May 14 12:13:18 1999 Ross Johnson * attr.c (pthread_attr_setdetachstate): Fix logic bug - Mike Russo . +Sat May 8 09:42:30 1999 Ross Johnson + + * pthread.def (sem_open): Add. + (sem_close): Add. + (sem_unlink): Add. + (sem_getvalue): Add. + + * FAQ (Question 3): Add. + +Thu Apr 8 01:16:23 1999 Ross Johnson + + * semaphore.c (sem_open): New function; returns an error (ENOSYS). + (sem_close): ditto. + (sem_unlink): ditto. + (sem_getvalue): ditto. + + * semaphore.h (_POSIX_SEMAPHORES): define. + Wed Apr 7 14:09:52 1999 Ross Johnson * errno.c (_REENTRANT || _MT): Invert condition. diff --git a/FAQ b/FAQ index 71e6359..885835d 100644 --- a/FAQ +++ b/FAQ @@ -10,6 +10,8 @@ Q 1 Should I use Cygwin or Mingw32 as a development environment? Q 2 Now that pthreads-win32 builds under Mingw32, why do I get memory access violations? +Q 3 How do I use pthread.dll for Win32 (Visual C++ 5.0) + ============================================================================= Q 1 Should I use Cygwin or Mingw32 as a development environment? @@ -137,3 +139,41 @@ able to tackle it myself. Kevin +------------------------------------------------------------------------------ + +Q 3 How do I use pthread.dll for Win32 (Visual C++ 5.0) +--- + +A 3 +--- +> +> I'm a "rookie" when it comes to your pthread implementation. I'm currently +> desperately trying to install the prebuilt .dll file into my MSVC compiler. +> Could you please provide me with explicit instructions on how to do this (or +> direct me to a resource(s) where I can acquire such information)? +> +> Thank you, +> + +You should have a .dll, .lib, .def, and three .h files. + +The .dll can go in any directory listed in your PATH environment +variable, so putting it into C:\WINDOWS should work. + +The .lib file can go in any directory listed in your LIB environment +variable. + +The .h files can go in any directory listed in your INCLUDE +environment variable. + +Or you might prefer to put the .lib and .h files into a new directory +and add its path to LIB and INCLUDE. You can probably do this easiest +by editing the file:- + +C:\Program Files\DevStudio\vc\bin\vcvars32.bat + +The .def file isn't used by anything in the pre-compiled version but +is included for information. + +Cheers. +Ross diff --git a/condvar.c b/condvar.c index c1f192c..580c379 100644 --- a/condvar.c +++ b/condvar.c @@ -817,7 +817,6 @@ pthread_cond_broadcast (pthread_cond_t * cond) */ { int result = 0; - int i; pthread_cond_t cv; if (cond == NULL || *cond == NULL) @@ -840,7 +839,7 @@ pthread_cond_broadcast (pthread_cond_t * cond) /* * Wake up all waiters */ - result = (ReleaseSemaphore( cv->sema, cond->waiters, NULL ) + result = (ReleaseSemaphore( cv->sema, cv->waiters, NULL ) ? 0 : EINVAL); @@ -865,5 +864,3 @@ pthread_cond_broadcast (pthread_cond_t * cond) return (result); } - - diff --git a/pthread.def b/pthread.def index 1039497..b7d1ce9 100644 --- a/pthread.def +++ b/pthread.def @@ -1,5 +1,5 @@ ; pthread.def -; Last updated: $Date: 1999/04/03 22:05:47 $ +; Last updated: $Date: 1999/05/29 06:44:34 $ ; Currently unimplemented functions are commented out. @@ -83,6 +83,10 @@ sem_destroy sem_trywait sem_wait sem_post +sem_open +sem_close +sem_unlink +sem_getvalue ; ; Non-portable but useful ; diff --git a/semaphore.c b/semaphore.c index cd463d3..0fcfc94 100644 --- a/semaphore.c +++ b/semaphore.c @@ -329,3 +329,36 @@ sem_post (sem_t * sem) return 0; } /* sem_post */ + + +int +sem_open (const char * name, int oflag, mode_t mode, unsigned int value) +{ + errno = ENOSYS; + return -1; +} /* sem_open */ + + +int +sem_close (sem_t * sem) +{ + errno = ENOSYS; + return -1; +} /* sem_close */ + + +int +sem_unlink (const char * name) +{ + errno = ENOSYS; + return -1; +} /* sem_unlink */ + + +int +sem_getvalue (sem_t * sem, int * sval) +{ + errno = ENOSYS; + return -1; +} /* sem_getvalue */ + diff --git a/semaphore.h b/semaphore.h index f5d9c83..e05cc4a 100644 --- a/semaphore.h +++ b/semaphore.h @@ -31,11 +31,15 @@ #include #include +#define _POSIX_SEMAPHORES + #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ +typedef unsigned int mode_t; + typedef HANDLE sem_t; int sem_init (sem_t * sem, @@ -55,6 +59,21 @@ int sem_wait (sem_t * sem int sem_post (sem_t * sem ); +int sem_open (const char * name, + int oflag, + ... + ); + +int sem_close (sem_t * sem + ); + +int sem_unlink (const char * name + ); + +int sem_getvalue (sem_t * sem, + int * sval + ); + #ifdef __cplusplus } /* End of extern "C" */ #endif /* __cplusplus */ diff --git a/tests/ChangeLog b/tests/ChangeLog index e0969ef..22b7028 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -1,3 +1,17 @@ +Sat May 29 23:29:04 1999 Ross Johnson + + * runall.bat (condvar5): Add new test. + + * runall.bat (condvar6): Add new test. + + * Makefile (condvar5) : Add new test. + + * Makefile (condvar6) : Add new test. + + * condvar5.c: New test for pthread_cond_broadcast(). + + * condvar6.c: New test for pthread_cond_broadcast(). + Sun Apr 4 12:04:28 1999 Ross Johnson * tsd1.c (mythread): Change Sleep(0) to sched_yield(). diff --git a/tests/Makefile b/tests/Makefile index 21309e5..f96d830 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -39,7 +39,8 @@ TESTS = mutex1 condvar1 condvar2 exit1 create1 equal1 \ exit2 exit3 \ join1 mutex2 mutex3 \ count1 once1 tsd1 self1 self2 eyal1 \ - condvar3 condvar4 errno1 + condvar3 condvar4 condvar5 condvar6 \ + errno1 PASSES = $(TESTS:%=%.pass) @@ -65,6 +66,8 @@ self2.pass: create1.pass eyal1.pass: tsd1.pass condvar3.pass: create1.pass condvar4.pass: create1.pass +condvar5.pass: condvar4.pass +condvar6.pass: condvar5.pass errno1.pass: mutex3.pass %.pass: %.exe $(LIB) $(DLL) $(HDR) diff --git a/tests/runall.bat b/tests/runall.bat index f061f3a..0e3801b 100644 --- a/tests/runall.bat +++ b/tests/runall.bat @@ -21,4 +21,6 @@ call runtest cl self2 call runtest cl eyal1 call runtest cl condvar3 call runtest cl condvar4 +call runtest cl condvar5 +call runtest cl condvar6 call runtest cl errno1 -- cgit v1.2.3