discuss-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Discuss-gnuradio] Freeze when writing to linux fifo pipe


From: Marcus D. Leech
Subject: Re: [Discuss-gnuradio] Freeze when writing to linux fifo pipe
Date: Tue, 20 Apr 2010 09:54:13 -0400
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.9) Gecko/20100330 Fedora/3.0.4-1.fc12 Thunderbird/3.0.4

On 04/20/2010 08:57 AM, Joachim Roop wrote:
> Hi,
> I am trying to write to a linux pipe/fifo, but sadly this seems to freeze 
> python. I am using Ubuntu 10.04 and gnuradio 3.2.2.dfsg-1ubuntu1.
> Please try to execute the code and tell me why this makes the app pause.
>
> #! /usr/bin/python
>
> # Import stuff
> from gnuradio import gr, gru, eng_notation, optfir
> from gnuradio.eng_option import eng_option
> from gnuradio.wxgui import slider, powermate
> from gnuradio.wxgui import stdgui2, fftsink2, form, scopesink2
> import sys
> import os
>
> # Main application
> class main_app (stdgui2.std_top_block):
>       def __init__(self,frame,panel,vbox,argv):
>               stdgui2.std_top_block.__init__ (self,frame,panel,vbox,argv)
>
>               print '!!!Cleanup'
>               os.spawnlp(os.P_WAIT, 'rm', 'rm','/tmp/gnutest1.raw')
>               os.spawnlp(os.P_WAIT, 'rm', 'rm','/tmp/gnutest2.raw')
>               print '!!!make a fifo'
>               os.spawnlp(os.P_WAIT, 'mkfifo', 'mkfifo','/tmp/gnutest1.raw')
>               print '!!!make file sink without the fifo'
>               outok = gr.file_sink(gr.sizeof_short,'/tmp/gnutest2.raw')
>               print '!!!make file sink with the fifo (FREEZING)'
>               outcrash = gr.file_sink(gr.sizeof_short, '/tmp/gnutest1.raw')
>               print '!!!everything went better than expected'
>
> if __name__ == '__main__':
>     app = stdgui2.stdapp (main_app, "crashtest")
>     app.MainLoop ()
>   
An open(2) call on a FIFO (named pipe) will only complete when the other
side (the reader) has opened
  the named-pipe for reading.  So your app will freeze until there's a
reader for the pipe.

You can open the FIFO non-blocking, but I don't know how you do that in
the gr.file_sink  call.



-- 
Marcus Leech
Principal Investigator
Shirleys Bay Radio Astronomy Consortium
http://www.sbrac.org






reply via email to

[Prev in Thread] Current Thread [Next in Thread]