[Pcsclite-muscle] About SHARED/EXCLUSIVE and starvation Was: Portable way to detect when a smart card is inserted

helpcrypto helpcrypto helpcrypto at gmail.com
Wed Sep 17 09:58:30 UTC 2014


On Mon, Sep 15, 2014 at 6:43 PM, Ludovic Rousseau <
ludovic.rousseau at gmail.com> wrote:

>
> Please, please do NOT use a loop of proposed by Bruno Jesus.
> I invested a lot of time in removing all polling loops in pcsc-lite
> and the CCID driver. So please do not add a polling loop in your
> application when you can do without one.
>

Talking about this, Ludovic, I'll like to ask you:

IIUC, using SHARED + BeginTransaction/EndTransaction could lead to
starvation:

Process A opens a shared connection and invokes beginTransaction
Process B opens a shared connection and invokes beginTransaction (blocked)
If evil process A never releases transaction, B will starve
A "complex" father-child process will be needed to detect if process B is
being blocked to be able to resume, right?


Using EXCLUSIVE with retry-loop seems to be better:
Process A opens an exclusive connection
Process B try to open an exclusive connection and fails (now it is aware of
other process using SC)
    process B could retry a few times, or even detect if its a deadlock
(process A died before releasing the connection)
Am I right?


Said so: are exclusive connections better in a non-controlled/evil
applications environment?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.alioth.debian.org/pipermail/pcsclite-muscle/attachments/20140917/c1309563/attachment.html>


More information about the Pcsclite-muscle mailing list