<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How can i implement something like poll() in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/how-can-i-implement-something-like-poll/m-p/2576034#M725331</link>
    <description>You can build this functionality  around the select () system call.&lt;BR /&gt;&lt;BR /&gt;see man 2 select&lt;BR /&gt;&lt;BR /&gt;Regards&lt;BR /&gt;Rainer&lt;BR /&gt;&lt;BR /&gt;</description>
    <pubDate>Thu, 06 Sep 2001 05:12:21 GMT</pubDate>
    <dc:creator>Rainer von Bongartz</dc:creator>
    <dc:date>2001-09-06T05:12:21Z</dc:date>
    <item>
      <title>How can i implement something like poll()</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-can-i-implement-something-like-poll/m-p/2576033#M725330</link>
      <description>In my program, a thread write data into a data queue (designed by myself, not message queue), another thread read from it. Because there is someother things to do, I can not block into reading the queue.&lt;BR /&gt;But polling the queue is wasting CPU time if the queue is empty. I want to implement something like poll() on the data queue. If the queue is empty and there is nothing to do, reading thread registers a readable event on it and block. After the data queue is writed and is no more empty, reading thread is waked up.&lt;BR /&gt;Is this idea naive ?</description>
      <pubDate>Thu, 06 Sep 2001 01:48:09 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-can-i-implement-something-like-poll/m-p/2576033#M725330</guid>
      <dc:creator>Victor.Lin_1</dc:creator>
      <dc:date>2001-09-06T01:48:09Z</dc:date>
    </item>
    <item>
      <title>Re: How can i implement something like poll()</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-can-i-implement-something-like-poll/m-p/2576034#M725331</link>
      <description>You can build this functionality  around the select () system call.&lt;BR /&gt;&lt;BR /&gt;see man 2 select&lt;BR /&gt;&lt;BR /&gt;Regards&lt;BR /&gt;Rainer&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 06 Sep 2001 05:12:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-can-i-implement-something-like-poll/m-p/2576034#M725331</guid>
      <dc:creator>Rainer von Bongartz</dc:creator>
      <dc:date>2001-09-06T05:12:21Z</dc:date>
    </item>
    <item>
      <title>Re: How can i implement something like poll()</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-can-i-implement-something-like-poll/m-p/2576035#M725332</link>
      <description>Really ? select() can only deal with file describer. How can it deal with semaphore(the data queue works based on semaphore)?</description>
      <pubDate>Thu, 06 Sep 2001 05:38:57 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-can-i-implement-something-like-poll/m-p/2576035#M725332</guid>
      <dc:creator>Victor.Lin_1</dc:creator>
      <dc:date>2001-09-06T05:38:57Z</dc:date>
    </item>
    <item>
      <title>Re: How can i implement something like poll()</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-can-i-implement-something-like-poll/m-p/2576036#M725333</link>
      <description>ok, in this case you can't use select()&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 06 Sep 2001 07:33:50 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-can-i-implement-something-like-poll/m-p/2576036#M725333</guid>
      <dc:creator>Rainer von Bongartz</dc:creator>
      <dc:date>2001-09-06T07:33:50Z</dc:date>
    </item>
    <item>
      <title>Re: How can i implement something like poll()</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-can-i-implement-something-like-poll/m-p/2576037#M725334</link>
      <description>i'm a little confused - how is it you cannot block trying to read something from the empty queue, but you can block in a poll-like call?</description>
      <pubDate>Thu, 06 Sep 2001 17:16:44 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-can-i-implement-something-like-poll/m-p/2576037#M725334</guid>
      <dc:creator>rick jones</dc:creator>
      <dc:date>2001-09-06T17:16:44Z</dc:date>
    </item>
    <item>
      <title>Re: How can i implement something like poll()</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-can-i-implement-something-like-poll/m-p/2576038#M725335</link>
      <description>Hi Victor,&lt;BR /&gt;&lt;BR /&gt;The situation you describe seems to be a perfect fit for message queues. msgrcv() and msgsnd() will do just the king of blocking you seem to be looking for - unless you need to transfer fairly large amounts of data. You may be trying to avoid the overhead of the copies or you may need to transfer more than the maximum allowed message size. I may have a solution: Use message queues essentially as semaphores to handle the blocking but do the&lt;BR /&gt;actual data transfers (or pointer references to avoid the copy) in shared memory. This should give you the best of both worlds.&lt;BR /&gt;&lt;BR /&gt;Food for thought, Clay</description>
      <pubDate>Thu, 06 Sep 2001 18:14:22 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-can-i-implement-something-like-poll/m-p/2576038#M725335</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2001-09-06T18:14:22Z</dc:date>
    </item>
    <item>
      <title>Re: How can i implement something like poll()</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-can-i-implement-something-like-poll/m-p/2576039#M725336</link>
      <description>ignore my question - i misinterpreted the text of the original problem statement.&lt;BR /&gt;&lt;BR /&gt;if there is nothing on your queue, you could grab a mutext and add to a notification queue the thread id and signal you want. then when something later adds to your queue, it can notice that there were notifications regsitered and send your original thread a signal via pthread_kill. of course, this presumes the original thread registers a signal handler first :)&lt;BR /&gt;&lt;BR /&gt;a variation would be that the original thread could register some form of FD instead of a signal under that notification mutex.  say perhaps one end of a loopback TCP connection or a unix domain socket or something. then the thread that adds to the queue will write something - perhaps just a junk byte - perhaps something with more meaning - to the connection. the other thread then will see this if they are in a select() or poll() for other FD's</description>
      <pubDate>Thu, 06 Sep 2001 19:15:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-can-i-implement-something-like-poll/m-p/2576039#M725336</guid>
      <dc:creator>rick jones</dc:creator>
      <dc:date>2001-09-06T19:15:00Z</dc:date>
    </item>
    <item>
      <title>Re: How can i implement something like poll()</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-can-i-implement-something-like-poll/m-p/2576040#M725337</link>
      <description>I am sorry. Because I can access Internet only two days one week in the company I am working in. Sometimes I can not reply and assign points in time.</description>
      <pubDate>Tue, 11 Sep 2001 07:25:14 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-can-i-implement-something-like-poll/m-p/2576040#M725337</guid>
      <dc:creator>Victor.Lin_1</dc:creator>
      <dc:date>2001-09-11T07:25:14Z</dc:date>
    </item>
  </channel>
</rss>

