summaryrefslogtreecommitdiff
path: root/mutex.c
diff options
context:
space:
mode:
authorbje <bje>1998-07-19 12:13:12 +0000
committerbje <bje>1998-07-19 12:13:12 +0000
commit6a4085ee02ab8bc5fa4388cede4ee73c1994567f (patch)
tree59a5b4b70ebf93b8aac5f410135c9fcdfebc41fd /mutex.c
parent2fd4465f8ade2ce3ac46faff7d32491a328d5162 (diff)
1998-07-19 Ben Elliston <bje@cygnus.com>
* mutex.c (pthread_mutex_trylock): Return ENOSYS if this function is called on a Win32 platform which is not Windows NT.
Diffstat (limited to 'mutex.c')
-rw-r--r--mutex.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/mutex.c b/mutex.c
index 6d425ab..da8737a 100644
--- a/mutex.c
+++ b/mutex.c
@@ -147,9 +147,15 @@ pthread_mutex_unlock(pthread_mutex_t *mutex)
int
pthread_mutex_trylock(pthread_mutex_t *mutex)
{
- /* This only works on Windows NT 4.0 and above. If this function is
- called from Windows 95, we must return ENOSYS. */
-
+ /* Typically evaluates to 31. */
+ int numbits = (sizeof(DWORD) * 8) - 1;
+
+ if ((GetVersion() >> numbits) != 1)
+ {
+ /* We're not on Windows NT; return ENOSYS. */
+ return ENOSYS;
+ }
+
if (mutex == NULL)
{
return EINVAL;