summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--FAQ39
-rw-r--r--README.NONPORTABLE31
3 files changed, 57 insertions, 18 deletions
diff --git a/ChangeLog b/ChangeLog
index 1623c31..bcc44be 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2004-05-20 Ross Johnson <ross@special.ise.canberra.edu.au>
+
+ * README.NONPORTABLE: Document pthread_win32_test_features_np().
+ * FAQ: Update various answers.
+
2004-05-19 Ross Johnson <rpj@callisto.canberra.edu.au>
* Makefile: Don't define _WIN32_WINNT on compiler command line.
diff --git a/FAQ b/FAQ
index c9ffe10..ee8968b 100644
--- a/FAQ
+++ b/FAQ
@@ -58,7 +58,7 @@ Simply, you only use one of them, but you need to choose carefully.
The most important choice you need to make is whether to use a
version that uses exceptions internally, or not (there are versions
of the library that use exceptions as part of the thread
-cancelation and exit implementation, and one that uses
+cancelation and cleanup implementation, and one that uses
setjmp/longjmp instead).
There is some contension amongst POSIX threads experts as
@@ -221,8 +221,9 @@ Q 5 Why is the default library version now less exception-friendly?
Because most commercial Unix POSIX threads implementations don't allow you to
choose to have stack unwinding. (Compaq's TRU64 Unix is possibly an exception.)
-Therefore, providing it in pthread-win32 as a default could be dangerous. We
-still provide the choice but you must now consciously make it.
+Therefore, providing it in pthread-win32 as a default could be dangerous
+and non-portable. We still provide the choice but you must now consciously
+make it.
WHY NOT REMOVE THE EXCEPTIONS VERSIONS OF THE LIBRARY ALTOGETHER?
There are a few reasons:
@@ -326,16 +327,11 @@ Q 9 Cancelation doesn't work for me, why?
> win32 programming, so I don't really understand how the *Event() family of
> calls work.
-Async cancelation should be in versions post snapshot-1999-11-02
-of pthreads-win32 (currently only for x86 architectures).
-
The answer to your first question is, normal POSIX behaviour would
be to asynchronously cancel the thread. However, even that doesn't
guarantee cancelation as the standard only says it should be
cancelled as soon as possible.
-However ...
-
Snapshot 99-11-02 or earlier only partially supports asynchronous cancellation.
Snapshots since then simulate async cancelation by poking the address of
a cancelation routine into the PC of the threads context. This requires
@@ -357,20 +353,34 @@ functions that are defined as deferred cancelation points, there is
no hookup between those which are provided by Windows and the
pthreads-win32 library.
-Incidently, it's worth noting for code portability that the POSIX
-threads standard list doesn't include "select" because (as I read in
-Butenhof) it isn't part of POSIX.
+Incidently, it's worth noting for code portability that the older POSIX
+threads standards cancelation point lists didn't include "select" because
+(as I read in Butenhof) it wasn't part of POSIX. However, it does appear in
+the SUSV3.
-Effectively, the only cancelation points that pthreads-win32 can
-recognise are those the library implements itself, ie.
+Effectively, the only mandatory cancelation points that pthreads-win32
+recognises are those the library implements itself, ie.
pthread_testcancel
pthread_cond_wait
pthread_cond_timedwait
pthread_join
sem_wait
+ sem_timedwait
pthread_delay_np
+The following routines from the non-mandatory list in SUSV3 are
+cancelation points in pthreads-win32:
+
+ pthread_rwlock_wrlock
+ pthread_rwlock_timedwrlock
+
+The following routines from the non-mandatory list in SUSV3 are not
+cancelation points in pthreads-win32:
+
+ pthread_rwlock_rdlock
+ pthread_rwlock_timedrdlock
+
Pthreads-win32 also provides two functions that allow you to create
cancelation points within your application, but only for cases where
a thread is going to block on a Win32 handle. These are:
@@ -379,9 +389,6 @@ a thread is going to block on a Win32 handle. These are:
pthreadCancelableTimedWait(HANDLE waitHandle, DWORD timeout)
-Regards.
-Ross
-
------------------------------------------------------------------------------
diff --git a/README.NONPORTABLE b/README.NONPORTABLE
index 12336bd..ae76862 100644
--- a/README.NONPORTABLE
+++ b/README.NONPORTABLE
@@ -3,6 +3,33 @@ This file documents non-portable functions and other issues.
Non-portable functions included in pthreads-win32
-------------------------------------------------
+BOOL
+pthread_win32_test_features_np(int mask)
+
+ This routine allows an application to check which
+ run-time auto-detected features are available within
+ the library.
+
+ The possible features are:
+
+ PTW32_SYSTEM_INTERLOCKED_COMPARE_EXCHANGE
+ Return TRUE if the native version of
+ InterlockedCompareExchange() is being used.
+ PTW32_ALERTABLE_ASYNC_CANCEL
+ Return TRUE is the QueueUserAPCEx package
+ QUSEREX.DLL is available and the AlertDrv.sys
+ driver is loaded into Windows, providing
+ alertable (pre-emptive) asyncronous threads
+ cancelation. If this feature returns FALSE
+ then the default async cancel scheme is in
+ use, which cannot cancel blocked threads.
+
+ Features may be Or'ed into the mask parameter, in which case
+ the routine returns TRUE if any of the Or'ed features would
+ return TRUE. At this stage it doesn't make sense to Or features
+ but it may some day.
+
+
void *
pthread_timechange_handler_np(void *)
@@ -17,7 +44,7 @@ pthread_timechange_handler_np(void *)
It has the same return type and argument type as a
thread routine so that it may be called directly
- through pthread_create() for asynchronicity.
+ through pthread_create(), i.e. as a separate thread.
Parameters
@@ -31,7 +58,7 @@ pthread_timechange_handler_np(void *)
Otherwise, 0 is returned.
If run as a thread, the return value is returned
- through pthread_join(), otherwise directly.
+ through pthread_join().
The return value should be cast to an integer.