[Pcsclite-cvs-commit] r2948 - /trunk/PCSC/src/thread_unix.c
rousseau at users.alioth.debian.org
rousseau at users.alioth.debian.org
Tue May 13 09:00:49 UTC 2008
Author: rousseau
Date: Tue May 13 09:00:47 2008
New Revision: 2948
URL: http://svn.debian.org/wsvn/pcsclite/?sc=1&rev=2948
Log:
forward the return value from the low level thread library and not just
FALSE or TRUE
The upper layer can then use strerror()
Modified:
trunk/PCSC/src/thread_unix.c
Modified: trunk/PCSC/src/thread_unix.c
URL: http://svn.debian.org/wsvn/pcsclite/trunk/PCSC/src/thread_unix.c?rev=2948&op=diff
==============================================================================
--- trunk/PCSC/src/thread_unix.c (original)
+++ trunk/PCSC/src/thread_unix.c Tue May 13 09:00:47 2008
@@ -18,11 +18,6 @@
#include "wintypes.h"
#include "thread_generic.h"
#include "misc.h"
-
-#ifndef TRUE
-#define TRUE 1
-#define FALSE 0
-#endif
INTERNAL int SYS_MutexInit(PCSCLITE_MUTEX_T mMutex)
{
@@ -53,47 +48,41 @@
PCSCLITE_THREAD_FUNCTION(pvFunction), LPVOID pvArg)
{
pthread_attr_t attr;
- int ret = FALSE;
+ int ret;
- if (0 != pthread_attr_init(&attr))
- return FALSE;
+ ret = pthread_attr_init(&attr);
+ if (ret)
+ return ret;
- if (0 != pthread_attr_setdetachstate(&attr,
- attributes & THREAD_ATTR_DETACHED ? PTHREAD_CREATE_DETACHED : PTHREAD_CREATE_JOINABLE))
+ ret = pthread_attr_setdetachstate(&attr,
+ attributes & THREAD_ATTR_DETACHED ? PTHREAD_CREATE_DETACHED : PTHREAD_CREATE_JOINABLE);
+ if (ret)
{
pthread_attr_destroy(&attr);
- return FALSE;
+ return ret;
}
- if (0 == pthread_create(pthThread, &attr, pvFunction, pvArg))
- ret = TRUE;
+ ret = pthread_create(pthThread, &attr, pvFunction, pvArg);
+ if (ret)
+ return ret;
- pthread_attr_destroy(&attr);
+ ret = pthread_attr_destroy(&attr);
return ret;
}
INTERNAL int SYS_ThreadCancel(PCSCLITE_THREAD_T pthThread)
{
- if (0 == pthread_cancel(pthThread))
- return TRUE;
- else
- return FALSE;
+ return pthread_cancel(pthThread);
}
INTERNAL int SYS_ThreadDetach(PCSCLITE_THREAD_T pthThread)
{
- if (0 == pthread_detach(pthThread))
- return TRUE;
- else
- return FALSE;
+ return pthread_detach(pthThread);
}
INTERNAL int SYS_ThreadJoin(PCSCLITE_THREAD_T pthThread, LPVOID* pvRetVal)
{
- if (0 == pthread_join(pthThread, pvRetVal))
- return TRUE;
- else
- return FALSE;
+ return pthread_join(pthThread, pvRetVal);
}
INTERNAL int SYS_ThreadExit(LPVOID pvRetVal)
More information about the Pcsclite-cvs-commit
mailing list