<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Mon, Sep 15, 2014 at 6:43 PM, Ludovic Rousseau <span dir="ltr"><<a href="mailto:ludovic.rousseau@gmail.com" target="_blank">ludovic.rousseau@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
Please, please do NOT use a loop of proposed by Bruno Jesus.<br>
I invested a lot of time in removing all polling loops in pcsc-lite<br>
and the CCID driver. So please do not add a polling loop in your<br>
application when you can do without one.<br></blockquote><div><br></div><div>Talking about this, Ludovic, I'll like to ask you:<br><br></div><div>IIUC, using SHARED + BeginTransaction/EndTransaction could lead to starvation:<br><br></div><div>Process A opens a shared connection and invokes beginTransaction<br>Process B opens a shared connection and invokes beginTransaction (blocked)<br></div><div>If evil process A never releases transaction, B will starve<br></div><div>A "complex" father-child process will be needed to detect if process B is being blocked to be able to resume, right?<br></div><br><br></div>Using EXCLUSIVE with retry-loop seems to be better:<br>Process A opens an exclusive connection<br>Process B try to open an exclusive connection and fails (now it is aware of other process using SC)<br></div><div class="gmail_extra"> process B could retry a few times, or even detect if its a deadlock (process A died before releasing the connection)<br></div><div class="gmail_extra">Am I right?<br><br></div><div class="gmail_extra"><br></div><div class="gmail_extra">Said so: are exclusive connections better in a non-controlled/evil applications environment?</div><div class="gmail_extra"><br><br></div></div>