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 _______________________________________________ Discuss-gnuradio mailing list Discuss-gnuradio@gnu.org http://lists.gnu.org/mailman/listinfo/discuss-gnuradio