summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrpj <rpj>1999-02-08 21:19:53 +0000
committerrpj <rpj>1999-02-08 21:19:53 +0000
commit9e253ed18b58158600fe1b4eed306c11523e7a53 (patch)
tree7583ba194efd2f8c8b035866d0f63a36d7bbb216
parent856068d292843ed7e8b3c49ecf55bd5f5c1b2368 (diff)
Fri Feb 5 13:42:30 1999 Ross Johnson <rpj@swan.canberra.edu.au>
* semaphore.c: Comment format changes. Wed Feb 3 13:04:44 1999 Ross Johnson <rpj@swan.canberra.edu.au> * cleanup.c: Rename _pthread_*_cleanup() to pthread_*_cleanup(). * pthread.def: Ditto. * pthread.h: Ditto. * pthread.def (pthread_cleanup_push): Remove from export list; the function is defined as a macro under all compilers. (pthread_cleanup_pop): Ditto. * pthread.h: Remove #if defined().
-rw-r--r--ChangeLog18
-rw-r--r--Makefile.in14
-rw-r--r--cleanup.c4
-rw-r--r--pthread.def10
-rw-r--r--pthread.h20
-rw-r--r--semaphore.c6
-rw-r--r--sync.c6
7 files changed, 53 insertions, 25 deletions
diff --git a/ChangeLog b/ChangeLog
index 6155236..852baee 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,21 @@
+Fri Feb 5 13:42:30 1999 Ross Johnson <rpj@swan.canberra.edu.au>
+
+ * semaphore.c: Comment format changes.
+
+Wed Feb 3 13:04:44 1999 Ross Johnson <rpj@swan.canberra.edu.au>
+
+ * cleanup.c: Rename _pthread_*_cleanup() to pthread_*_cleanup().
+
+ * pthread.def: Ditto.
+
+ * pthread.h: Ditto.
+
+ * pthread.def (pthread_cleanup_push): Remove from export list;
+ the function is defined as a macro under all compilers.
+ (pthread_cleanup_pop): Ditto.
+
+ * pthread.h: Remove #if defined().
+
Wed Feb 3 10:13:48 1999 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
* sync.c (pthread_join): Check for NULL value_ptr arg;
diff --git a/Makefile.in b/Makefile.in
index b7db1af..91a1580 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -1,3 +1,5 @@
+RM = erase
+
CC = g++
# Mingw32
@@ -18,6 +20,7 @@ DLL = pthread.dll
LIB = libpthread32.a
+
all: $(DLL)
$(LIB): $(OBJS)
@@ -34,6 +37,11 @@ $(DLL): $(OBJS)
dlltool --def $*.def --output-lib $*.lib --dllname $@
clean:
- -rm *~
- -rm $(LIB) *.o *.exe
- -rm $(DLL) $(DLL:.dll=.base) $(DLL:.dll=.exp) $(DLL:.dll=.lib)
+ -$(RM) *~
+ -$(RM) $(LIB)
+ -$(RM) *.o
+ -$(RM) *.exe
+ -$(RM) $(DLL)
+ -$(RM) $(DLL:.dll=.base)
+ -$(RM) $(DLL:.dll=.exp)
+ -$(RM) $(DLL:.dll=.lib)
diff --git a/cleanup.c b/cleanup.c
index 012b82e..df7dec3 100644
--- a/cleanup.c
+++ b/cleanup.c
@@ -20,7 +20,7 @@
*/
_pthread_cleanup_t *
-_pthread_pop_cleanup (int execute)
+pthread_pop_cleanup (int execute)
/*
* ------------------------------------------------------
* DOCPUBLIC
@@ -120,7 +120,7 @@ _pthread_pop_cleanup (int execute)
void
-_pthread_push_cleanup (_pthread_cleanup_t * cleanup,
+pthread_push_cleanup (_pthread_cleanup_t * cleanup,
void (*routine) (void *),
void *arg)
/*
diff --git a/pthread.def b/pthread.def
index 542f07b..4f8c69e 100644
--- a/pthread.def
+++ b/pthread.def
@@ -1,5 +1,5 @@
; pthread.def
-; Last updated: $Date: 1999/02/02 02:02:08 $
+; Last updated: $Date: 1999/02/08 21:19:57 $
; Currently unimplemented functions are commented out.
@@ -24,8 +24,8 @@ pthread_attr_setschedparam
;pthread_attr_setstackaddr
pthread_attr_setstacksize
pthread_cancel
-pthread_cleanup_pop
-pthread_cleanup_push
+;pthread_cleanup_pop
+;pthread_cleanup_push
pthread_condattr_destroy
pthread_condattr_getpshared
pthread_condattr_init
@@ -77,5 +77,5 @@ pthreadCancelableTimedWait
;
; Needed if !defined(_MSC_VER) && !defined(__cplusplus)
;
-_pthread_push_cleanup
-_pthread_pop_cleanup
+pthread_push_cleanup
+pthread_pop_cleanup
diff --git a/pthread.h b/pthread.h
index e0fc11f..415602c 100644
--- a/pthread.h
+++ b/pthread.h
@@ -710,10 +710,10 @@ struct _pthread_cleanup_t
{ \
_pthread_cleanup_t _cleanup; \
\
- _pthread_push_cleanup( &_cleanup, (_rout), (_arg) ); \
+ pthread_push_cleanup( &_cleanup, (_rout), (_arg) ); \
#define pthread_cleanup_pop( _execute ) \
- (void) _pthread_pop_cleanup( _execute ); \
+ (void) pthread_pop_cleanup( _execute ); \
}
#else /* !__cplusplus */
@@ -851,16 +851,6 @@ pthread_t pthread_self (void);
int pthread_cancel (pthread_t thread);
-#if !defined(__cplusplus) && !defined(_MSC_VER)
-
-_pthread_cleanup_t *_pthread_pop_cleanup (int execute);
-
-void _pthread_push_cleanup (_pthread_cleanup_t * cleanup,
- void (*routine) (void *),
- void *arg);
-
-#endif /* !__cplusplus && ! _MSC_VER */
-
int pthread_setcancelstate (int state,
int *oldstate);
@@ -872,6 +862,12 @@ void pthread_testcancel (void);
int pthread_once (pthread_once_t * once_control,
void (*init_routine) (void));
+_pthread_cleanup_t *pthread_pop_cleanup (int execute);
+
+void pthread_push_cleanup (_pthread_cleanup_t * cleanup,
+ void (*routine) (void *),
+ void *arg);
+
/*
* Thread Specific Data Functions
*/
diff --git a/semaphore.c b/semaphore.c
index e682201..f3bd5c9 100644
--- a/semaphore.c
+++ b/semaphore.c
@@ -68,7 +68,7 @@ _pthread_sem_init (_pthread_sem_t * sem, int pshared, unsigned int value)
* initial value of the semaphore is set to 'value'.
*
* RESULTS
- * 0 successfully created semaphore,
+ * 0 successfully created semaphore,
* EINVAL 'sem' is not a valid semaphore,
* ENOSPC a required resource has been exhausted,
* ENOSYS semaphores are not supported,
@@ -127,7 +127,7 @@ _pthread_sem_destroy (_pthread_sem_t * sem)
* This function destroys an unnamed semaphore.
*
* RESULTS
- * 0 successfully destroyed semaphore,
+ * 0 successfully destroyed semaphore,
* EINVAL 'sem' is not a valid semaphore,
* ENOSYS semaphores are not supported,
* EBUSY threads (or processes) are currently
@@ -163,7 +163,7 @@ _pthread_sem_trywait (_pthread_sem_t * sem)
* this function returns immediately with the error EAGAIN
*
* RESULTS
- * 0 successfully destroyed semaphore,
+ * 0 successfully decreased semaphore,
* EAGAIN the semaphore was already locked,
* EINVAL 'sem' is not a valid semaphore,
* ENOSYS semaphores are not supported,
diff --git a/sync.c b/sync.c
index 5b4ee9a..b7de5ac 100644
--- a/sync.c
+++ b/sync.c
@@ -123,6 +123,12 @@ pthread_join (pthread_t thread, void **value_ptr)
}
else
{
+ /*
+ * FIXME: This call frees memory used to hold the 'thread'
+ * object. 'thread' will be invalid after the first call.
+ *
+ * Only the last exiting join should free 'thread'.
+ */
_pthread_threadDestroy (thread);
}
}