Thread: data at fifo's receiving end has arrived?

  1. #1
    Registered User
    Join Date
    Jul 2006
    Posts
    22

    data at fifo's receiving end has arrived?

    How i can come to know that data is available at receiving end of fifo . Is there any way to know this asynchronously other than blocked reading or continuous polling.

    situation is such ( presenting in abstract manner): In main thread, an other member-thread is . In this member-thread , i open a fifo for non bloced reading. This fifo will receve values from some other process. And i want to pass these values to main thread.
    2 issues are here:
    1. How i will come to know some-data is available in fifo. Currently i am going for periodic reading?
    2. How to inform this to main thread.

    here i know ,a lot of things are fishy. I am looking for guidance how to make that well.

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    If the fifo is a file descriptor, then you can use select() or poll() to test whether information is available.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Registered User
    Join Date
    Jul 2006
    Posts
    22
    i googled select(). In pages, at some places i found it is blocking for some action o happen over file escriptors. I couldnt get it. I request for elaboration on this.

    Also select() provide me partial solution. Here i have to check it whether data is available or not. Is there any other way which kerenel can inform me that something available for reading on this file descriptor and i can do some routuine over that.

  4. #4
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    You can specify a timeout with the last parameter to select, to make it wait a while, but ultimately non-blocking.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. data structure design for data aggregation
    By George2 in forum C# Programming
    Replies: 0
    Last Post: 05-20-2008, 06:43 AM
  2. TcpClient stops receiving data
    By cx323 in forum C# Programming
    Replies: 0
    Last Post: 06-16-2006, 10:05 PM
  3. HUGE fps jump
    By DavidP in forum Game Programming
    Replies: 23
    Last Post: 07-01-2004, 10:36 AM
  4. C diamonds and perls :°)
    By Carlos in forum A Brief History of Cprogramming.com
    Replies: 7
    Last Post: 05-16-2003, 10:19 PM
  5. gcc problem
    By bjdea1 in forum Linux Programming
    Replies: 13
    Last Post: 04-29-2002, 06:51 PM