<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent posts to Discussion</title><link href="https://sourceforge.net/p/libserial/discussion/" rel="alternate"/><link href="https://sourceforge.net/p/libserial/discussion/feed.atom" rel="self"/><id>https://sourceforge.net/p/libserial/discussion/</id><updated>2016-01-19T19:50:14.552000Z</updated><subtitle>Recent posts to Discussion</subtitle><entry><title>SIGIO Handler Reentrant?</title><link href="https://sourceforge.net/p/libserial/discussion/29398/thread/d6a01c7f/" rel="alternate"/><published>2016-01-19T19:50:14.552000Z</published><updated>2016-01-19T19:50:14.552000Z</updated><author><name>Ludvik Jerabek</name><uri>https://sourceforge.net/u/ljerabek/</uri></author><id>https://sourceforge.net75d311272d17ce970bc6c5d75ab56c3006aaf91e</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;I was reviewing your code and I am wondering if the SIGIO hander. According to SUSv3:&lt;/p&gt;
&lt;p&gt;&lt;em&gt;"whose effect, when called by two or more threads, is guaranteed to be as if the threads each executed the function one after another in an undefined order, even if the actual execution is interleaved"&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;It seems that the SIGIO handler writes to shared std::vectors and is only expecting at most one SIGIO call at a time where:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Writing to shared mInputBuffer if there the mutex is not locked&lt;/li&gt;
&lt;li&gt;Wriring to shared shadowInputBuffer if the mutex is locked&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Data will not be avaliable to read if the last shadowInputBuffer was written and no subsequent SIGIO is delivered.&lt;/p&gt;
&lt;p&gt;----------reading mInputBuffer-----------&amp;gt;&lt;br/&gt;
----------incoming data written to shadowInputBuffer----------&amp;gt;&lt;br/&gt;
Since SIGIO only occurs if data from the device can be read, it is possible to leave data in the shadowInputBuffer leaving mInputBuffer empty.&lt;/p&gt;
&lt;p&gt;Let me know if this makes sense.&lt;/p&gt;&lt;/div&gt;</summary></entry></feed>