Martin Paljak
2009-11-30 15:42:02 UTC
Hi.
What is the status of multithreaded access to pcsc-lite? Is it supposed to work?
SCardGetStatusChange(timeout=INFINITE) with latest pcsc-lite fails as it holds the mutex for ... infinite time :) The Windows test shows that a SCardGetStatusChange(timeout=0) is supposed to return even when a "infinitely" blocking call is going on.
I attach a simple test program written with python/pyscard and the output from Winows:
Context established!
PCSC Readers: ['OMNIKEY CardMan 1021 0']
----- Current reader and card states are: -------
OMNIKEY CardMan 1021 0 0x3B 0x6E 0x00 0xFF 0x45 0x73 0x74 0x45 0x49 0x44 0x20 0x76 0x65 0x72 0x20 0x31 0x2E 0x30
Card present in reader
State changed
Launching a new thread
Sleeping a little ...
----- Please insert or remove a card ------------ <--- don't really insert anything
Getting status without a timeout
Got statuses: <--- a non-blocking access in another thread returns right away.
OMNIKEY CardMan 1021 0 0x3B 0x6E 0x00 0xFF 0x45 0x73 0x74 0x45 0x49 0x44 0x20 0x76 0x65 0x72 0x20 0x31 0x2E 0x30
Card present in reader
State changed
----- New reader and card states are: -----------
OMNIKEY CardMan 1021 0
Reader empty
State changed
Released context.
This makes my re-written blocking C_WaitForSlotEvent() implementation in OpenSC unusable on non-windows platforms :(
I don't know enough about pcsc-lite internals to fix the problem.
What is the status of multithreaded access to pcsc-lite? Is it supposed to work?
SCardGetStatusChange(timeout=INFINITE) with latest pcsc-lite fails as it holds the mutex for ... infinite time :) The Windows test shows that a SCardGetStatusChange(timeout=0) is supposed to return even when a "infinitely" blocking call is going on.
I attach a simple test program written with python/pyscard and the output from Winows:
Context established!
PCSC Readers: ['OMNIKEY CardMan 1021 0']
----- Current reader and card states are: -------
OMNIKEY CardMan 1021 0 0x3B 0x6E 0x00 0xFF 0x45 0x73 0x74 0x45 0x49 0x44 0x20 0x76 0x65 0x72 0x20 0x31 0x2E 0x30
Card present in reader
State changed
Launching a new thread
Sleeping a little ...
----- Please insert or remove a card ------------ <--- don't really insert anything
Getting status without a timeout
Got statuses: <--- a non-blocking access in another thread returns right away.
OMNIKEY CardMan 1021 0 0x3B 0x6E 0x00 0xFF 0x45 0x73 0x74 0x45 0x49 0x44 0x20 0x76 0x65 0x72 0x20 0x31 0x2E 0x30
Card present in reader
State changed
----- New reader and card states are: -----------
OMNIKEY CardMan 1021 0
Reader empty
State changed
Released context.
This makes my re-written blocking C_WaitForSlotEvent() implementation in OpenSC unusable on non-windows platforms :(
I don't know enough about pcsc-lite internals to fix the problem.