From 6a4085ee02ab8bc5fa4388cede4ee73c1994567f Mon Sep 17 00:00:00 2001 From: bje Date: Sun, 19 Jul 1998 12:13:12 +0000 Subject: 1998-07-19 Ben Elliston * mutex.c (pthread_mutex_trylock): Return ENOSYS if this function is called on a Win32 platform which is not Windows NT. --- mutex.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'mutex.c') 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; -- cgit v1.2.3