summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrpj <rpj>2010-02-15 14:13:58 +0000
committerrpj <rpj>2010-02-15 14:13:58 +0000
commit135d6f060c5e5232311af77bd0d0f500e861290c (patch)
tree1b8a6c26c2e7cfbee073a7c138a564296934882a
parent866c278580edc88765929fdbc5235d15bab44d3d (diff)
Comments and code style changes
-rw-r--r--global.c2
-rw-r--r--implement.h3
-rw-r--r--pthread_join.c4
-rw-r--r--pthread_win32_attach_detach_np.c10
4 files changed, 14 insertions, 5 deletions
diff --git a/global.c b/global.c
index 2b55422..e92b8f1 100644
--- a/global.c
+++ b/global.c
@@ -49,7 +49,7 @@ pthread_cond_t ptw32_cond_list_tail = NULL;
int ptw32_concurrency = 0;
-/* What features have been auto-detaected */
+/* What features have been auto-detected */
int ptw32_features = 0;
BOOL ptw32_smp_system = PTW32_TRUE; /* Safer if assumed true initially. */
diff --git a/implement.h b/implement.h
index cf3c7f4..69930ef 100644
--- a/implement.h
+++ b/implement.h
@@ -151,6 +151,9 @@ struct ptw32_thread_t_
int implicit:1;
void *keys;
void *nextAssoc;
+#ifdef _POSIX_CXX09_EXTENSIONS
+ int refs; /* C++ Thread Support Library extension */
+#endif
};
diff --git a/pthread_join.c b/pthread_join.c
index 72a3a74..3804327 100644
--- a/pthread_join.c
+++ b/pthread_join.c
@@ -104,7 +104,7 @@ pthread_join (pthread_t thread, void **value_ptr)
LeaveCriticalSection (&ptw32_thread_reuse_lock);
- if (result == 0)
+ if (0 == result)
{
/*
* The target thread is joinable and can't be reused before we join it.
@@ -124,7 +124,7 @@ pthread_join (pthread_t thread, void **value_ptr)
/*
* Pthread_join is a cancelation point.
* If we are canceled then our target thread must not be
- * detached (destroyed). This is guarranteed because
+ * detached (destroyed) by us. This is guarranteed because
* pthreadCancelableWait will not return if we
* are canceled.
*/
diff --git a/pthread_win32_attach_detach_np.c b/pthread_win32_attach_detach_np.c
index 7911fe1..5bbd925 100644
--- a/pthread_win32_attach_detach_np.c
+++ b/pthread_win32_attach_detach_np.c
@@ -283,7 +283,7 @@ pthread_win32_thread_detach_np ()
*/
ptw32_thread_t * sp = (ptw32_thread_t *) pthread_getspecific (ptw32_selfThreadKey);
- if (sp != NULL) // otherwise Win32 thread with no implicit POSIX handle.
+ if (sp != NULL)
{
ptw32_callUserDestroyRoutines (sp->ptHandle);
@@ -291,10 +291,16 @@ pthread_win32_thread_detach_np ()
sp->state = PThreadStateLast;
/*
* If the thread is joinable at this point then it MUST be joined
- * or detached explicitly by the application.
+ * or detached explicitly by the application because it's
+ * detachState cannot be changed from this point on.
*/
(void) pthread_mutex_unlock (&sp->cancelLock);
+ /*
+ * No race condition here because detachState will not be changed
+ * elsewhere now that thread state is PThreadStateLast (set above
+ * behind mutex).
+ */
if (sp->detachState == PTHREAD_CREATE_DETACHED)
{
ptw32_threadDestroy (sp->ptHandle);