diff options
author | Robert Relyea <rrelyea@redhat.com> | 2010-10-03 14:34:43 +0200 |
---|---|---|
committer | Alon Levy <alevy@redhat.com> | 2010-10-03 14:36:55 +0200 |
commit | a256875a5947dbea1d6a066698e2948071519714 (patch) | |
tree | 47a5100e5df60178ab4eb5b41a1beb83498fafe6 /mutex.h | |
parent | b1a3c160735ccbf0ba5539e957d400660ebb6ec3 (diff) |
passthru and multiple reader support.
New Features, library:
- added passthru mode: pass thru can be used either as a card_type and an
existing emulator, or as it's own emulator. When used as it's own emulator,
only the passhthru card type is supported. Enabling Passhtru is a compile
time option (you can build without it). It is still selected for at run-time
- added argument parsing code for the NSS emulator. This allows the argument
structure to move back to the emulator dependent directory. (This allows
other emulators to be implemented without the application needing to know
about emulator specific stuff.
- added functions to get the reader name and id, and have the caller set
the reader id.
- added vevent_get_next_vevent() - non-blocking event grabber.
- added string arguments to the card_type_init functions (currently not used).
- added VCARD_DIRECT card type which passes all the apdus the the card type's
last applet.
- added function to optionally get the ATR from the card type emul instead
of the emulator. NOTE: apps should now call vcard_get_atr rather than
vcard_emul_get_atr.
- Fixed the VCARD_ATR_PREFIX to take a constant signifying the number of
additional historical bytes for the card emulator.
- added usage statment.
New Features, vscclient.c
- vscclient now handles multiple readers, assuming multiple readers are
defined in qemu.
- vscclient now calls the emul to parse the command line arguments.
- vscclient has an option to enable passthru
- vscclient now passes the real reader name to qemu
- vscclient has 2 new commands:
debug [level] -- sets the various levels of debugging output on the fly.
list -- lists all the active readers, their card state and their name.
Diffstat (limited to 'mutex.h')
-rw-r--r-- | mutex.h | 18 |
1 files changed, 16 insertions, 2 deletions
@@ -16,6 +16,11 @@ License along with this library; if not, see <http://www.gnu.org/licenses/>. */ +/* + * This header file provides a way of mapping windows and linux thread calls to a set of macros. + * Ideally this would be shared by whatever subsystem we link with. + */ + #ifndef _H_MUTEX #define _H_MUTEX #ifdef _WIN32 @@ -28,16 +33,25 @@ typedef CONDITION_VARIABLE condition_t; #define CONDITION_INIT(cond) InitializeConditionVariable(&cond) #define CONDITION_WAIT(cond,mutex) SleepConditionVariableCS(&cond,&mutex,INFINTE) #define CONDITION_NOTIFY(cond) WakeConditionVariable(&cond) +typedef DWORD thread_t; +typedef HANDLE thread_status_t; +#define THREAD_CREATE(tid, func, arg) \ + CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)func, arg, 0, &tid) +#define THREAD_SUCCESS(status) ((status) != NULL) #else #include <pthread.h> typedef pthread_mutex_t mutex_t; -#define MUTEX_INIT(mutex) pthread_mutex_init(&mutex, NULL); +#define MUTEX_INIT(mutex) pthread_mutex_init(&mutex, NULL) #define MUTEX_LOCK(mutex) pthread_mutex_lock(&mutex) #define MUTEX_UNLOCK(mutex) pthread_mutex_unlock(&mutex) typedef pthread_cond_t condition_t; -#define CONDITION_INIT(cond) pthread_cond_init(&cond, NULL); +#define CONDITION_INIT(cond) pthread_cond_init(&cond, NULL) #define CONDITION_WAIT(cond,mutex) pthread_cond_wait(&cond,&mutex) #define CONDITION_NOTIFY(cond) pthread_cond_signal(&cond) +typedef pthread_t thread_t; +typedef int thread_status_t; +#define THREAD_CREATE(tid, func, arg) pthread_create(&tid, NULL, func, arg) +#define THREAD_SUCCESS(status) ((status) == 0) #endif #endif // _H_MUTEX |