On 01.12.2009, at 9:57, Ludovic Rousseau wrote:
> 2009/11/30 Martin Paljak <[email protected]>:
>> What is the status of multithreaded access to pcsc-lite? Is it supposed to 
>> work?
> 
> Yes. But each thread needs to have its own context. You shall call
> SCardEstablishContext() in the newly created thread and you program
> should work (not yet tested with your sample).
OK, I noticed the comment in SCardEstablichContext documentation of pcsc-lite: 
Each thread of an application shall use its own SCARDCONTEXT.

Apparently other calls work (in sequential mode?) so that it has not been 
noticed before. In theory is it important to call SCardEstablishContext for 
every thread and every API call or in real life it only affects cases like 
SCardGetStatusChange with infinite timeout?

It is not straightforward to fix the situation in OpenSC(PKCS#11) either, as 
there is no way to know in PKCS#11 if a new thread has been started than to 
keep a list of existing thread id-s and check that one of the id-s maches for 
every pcsc-lite call and manage a list of context handles as well..

Although not necessary for SCardGetStatusChange (which only requires a context 
handle), if the requirement would be true for all API calls, then every new 
thread would also have to make the full connection establishment to be able to 
talk to the card?


> I already tried to detect the problem and return
> SCARD_E_INVALID_HANDLE but that is not easy.
> 
> I note to add this "limitation" to the "Known differences with
> Microsoft Windows WinSCard implementation:"

Shall this remain like this by design or will it be fixed?


-- 
Martin Paljak
http://martin.paljak.pri.ee
+372.515.6495





_______________________________________________
Muscle mailing list
[email protected]
http://lists.drizzle.com/mailman/listinfo/muscle

Reply via email to