Re: spawn issue - was: open sockets [message #53094] |
Wed, 21 March 2007 10:35 |
JD Smith
Messages: 850 Registered: December 1999
|
Senior Member |
|
|
On Wed, 21 Mar 2007 18:13:00 +0100, Bringfried Stecklum wrote:
> Dear JD,
>
> thanks for this advice. I am using the XPA interface for various
> purposes but did not try the shm command yet. I agree that it will be
> much faster. So I'll give it a try.
Let us know how you fare. I've often thought of sending data via SHM to
DS9, but haven't yet tried it.
|
|
|
Re: spawn issue - was: open sockets [message #53096 is a reply to message #53094] |
Wed, 21 March 2007 10:13  |
Bringfried Stecklum
Messages: 75 Registered: January 1996
|
Member |
|
|
Dear JD,
thanks for this advice. I am using the XPA interface for various
purposes but did not try the shm command yet. I agree that it will be
much faster. So I'll give it a try.
regards,
Bringfried
JD Smith wrote:
> On Tue, 20 Mar 2007 19:35:39 +0100, Bringfried Stecklum wrote:
>
>> It is clear now that the issue is unrelated to socket but in fact caused
>> by multiple calls to spawn each of which opens a pipe to transfer the data
>> like
>>
>> spawn,'ds9 stdin',unit=unit
>> writefits,'/dev/null',image,header,unit=unit
>>
>> The problem is that after closing ds9 the pipe is still open. It seems
>> there is no way to make IDL aware that the child process no longer exists.
>
> DS9 uses XPA for passing all sorts of information indirectly via other
> programs:
>
> http://hea-www.harvard.edu/RD/ds9/ref/xpa.html
>
> With it, you should be able to stuff data from IDL into a shared
> memory segment, and point DS9 at that segment, setting up all view
> parameters as well. Not only would this remove the pipe issues, it
> would be much faster and more flexible as well.
>
> JD
>
>
|
|
|
Re: spawn issue - was: open sockets [message #53097 is a reply to message #53096] |
Wed, 21 March 2007 09:20  |
JD Smith
Messages: 850 Registered: December 1999
|
Senior Member |
|
|
On Tue, 20 Mar 2007 19:35:39 +0100, Bringfried Stecklum wrote:
> It is clear now that the issue is unrelated to socket but in fact caused
> by multiple calls to spawn each of which opens a pipe to transfer the data
> like
>
> spawn,'ds9 stdin',unit=unit
> writefits,'/dev/null',image,header,unit=unit
>
> The problem is that after closing ds9 the pipe is still open. It seems
> there is no way to make IDL aware that the child process no longer exists.
DS9 uses XPA for passing all sorts of information indirectly via other
programs:
http://hea-www.harvard.edu/RD/ds9/ref/xpa.html
With it, you should be able to stuff data from IDL into a shared
memory segment, and point DS9 at that segment, setting up all view
parameters as well. Not only would this remove the pipe issues, it
would be much faster and more flexible as well.
JD
|
|
|
Re: spawn issue - was: open sockets [message #53103 is a reply to message #53097] |
Wed, 21 March 2007 06:39  |
Bringfried Stecklum
Messages: 75 Registered: January 1996
|
Member |
|
|
Dear Lajos,
thanks for your suggestion which, however, seems to require to run two
programs in parallel, the main loop and the checking procedure. Since I
don't know how to do that I found another solution. It is based on the
unit and pid numbers provided by the procedure which calls ds9. Within
the main loop a test is invoked when the number of units in use exceeds
a certain number (25). The test checks for the existence of defunct
instances of ds9 (these are the ones which were terminated by closing
the window/exiting). If there are none the main loop has to wait until
ds9 windows will be closed by the user. Otherwise the units of those
pids which are defunct will be deallocated and their unit/pid numbers
removed from the bookkeeping pool of units/pids. Now I can inspect one
image after the other...
regards,
Bringfried
F�LDY Lajos wrote:
>
> On Tue, 20 Mar 2007, Bringfried Stecklum wrote:
>
>> It is clear now that the issue is unrelated to socket but in fact caused
>> by multiple calls to spawn each of which opens a pipe to transfer the
>> data like
>>
>> spawn,'ds9 stdin',unit=unit
>> writefits,'/dev/null',image,header,unit=unit
>>
>> The problem is that after closing ds9 the pipe is still open. It seems
>> there is no way to make IDL aware that the child process no longer
>> exists.
>>
>
> If you use the exit button in ds9, the pipe will remain open. You should
> call 'FREE_LUN, unit' to exit ds9 (and close the pipe).
>
> If you have multiple ds9 windows, you can add titles to them, and record
> the title-unit pairs, and write a little procedure to find the unit
> number belonging to the title, and call FREE_LUN for it.
>
> regards,
> lajos
>
|
|
|
Re: spawn issue - was: open sockets [message #53109 is a reply to message #53103] |
Tue, 20 March 2007 13:36  |
Foldy Lajos
Messages: 268 Registered: October 2001
|
Senior Member |
|
|
On Tue, 20 Mar 2007, Bringfried Stecklum wrote:
> It is clear now that the issue is unrelated to socket but in fact caused
> by multiple calls to spawn each of which opens a pipe to transfer the
> data like
>
> spawn,'ds9 stdin',unit=unit
> writefits,'/dev/null',image,header,unit=unit
>
> The problem is that after closing ds9 the pipe is still open. It seems
> there is no way to make IDL aware that the child process no longer exists.
>
If you use the exit button in ds9, the pipe will remain open. You should
call 'FREE_LUN, unit' to exit ds9 (and close the pipe).
If you have multiple ds9 windows, you can add titles to them, and record
the title-unit pairs, and write a little procedure to find the unit number
belonging to the title, and call FREE_LUN for it.
regards,
lajos
|
|
|