discuss-gnuradio
[Top][All Lists]
Advanced

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

Re: [Discuss-gnuradio] Passing file descriptors via SWIG


From: Martin Braun
Subject: Re: [Discuss-gnuradio] Passing file descriptors via SWIG
Date: Fri, 13 Mar 2009 16:05:58 +0100
User-agent: Mutt/1.5.17 (2007-11-01)

On Fri, Mar 13, 2009 at 07:09:26AM -0700, Eric Blossom wrote:
> On Fri, Mar 13, 2009 at 01:49:31PM +0100, Martin Braun wrote:
> > Hi,
> > 
> > following
> > http://lists.gnu.org/archive/html/discuss-gnuradio/2009-02/msg00400.html,
> > I tried connecting two processes with a FIFO using gr.file_descriptor_*.
> > 
> > However, I can't seem to pass the file descriptor from the Python to the
> > C++ domain. This is the error message I get:
> > 
> > gr_file_descriptor_sink: Bad file descriptor
> >
> > This is the code (pipe1 was created by using 'mkfifo pipe1'):
> 
> The python file object, fid, is going out of scope, and thus the
> underlying file is being closed.  Try self.fid = open(...)

Thanks, Eric, that helped.
If anyone ever tries doing this: Both Python and gr_file_descriptor_sink
will try to close the file, resulting in a warning. If you ask me,
gr_file_descriptor_* should not close the file in the destructors - if
anyone's using these blocks, they should usually know what they're
doing. Plus, to use a gr_file_descriptor, you need to open the file
yourself beforehand, the closing should thus happen in the same scope. I
suggest kicking the close() lines from
gr_file_descriptor*::~gr_file_descriptor*.

Just my two Euro-cents...
MB

-- 
Dipl.-Ing. Martin Braun           Phone: +49-(0)721-608 3790
Institut fuer Nachrichtentechnik  Fax:   +49-(0)721-608 6071
Universitaet Karlsruhe (TH)       http://www.int.uni-karlsruhe.de/

Attachment: pgpSaFQZXkHdY.pgp
Description: PGP signature


reply via email to

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