comp.lang.idl-pvwave archive - RDF feed
type: channel
description: Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado
items: Re: Aynchronous IO and Widgets

Re: Aynchronous IO and Widgets
type: item
description: Struan Gray <struan.gray@sljus.lu.se> wrote: > > I want to use IDL to control instruments in the lab but also want to avoid > inflicting long waiting times on my users. > > What I had in mind was to use a stub widget which would use CALL_EXTERNAL > to call an asynchronous I/O routine written in C whose completion routine > would then insert an event into the IDL event queue, telling the instrument > control base widget that the data was ready to collect. > If anyone works out how to send events from within C routines I would be VERY interested to hear how they did it. I haven't tried this myself but it seems like something that would be very useful. Dave Foster foster@bial6.ucsd.edu Brain Image Analysis Lab, UCSD
creator: David S. Foster/Admin
date: 1995-12-21T08:00:00-00:00

Re: Aynchronous IO and Widgets
type: item
description: In article <4b653h$58p@merkurius.lu.se>, Struan Gray <struan.gray@sljus.lu.se> writes: > I want to use IDL to control instruments in the lab but also want to avoid > inflicting long waiting times on my users. I've read the manual and played > with some simple widget building and recognise that IDL is not meant to be > threaded, and in particular wants each routine to finish before starting the > next one. > > The problem is I want to collect data from rather slow devices which > buffer a few kB before sending it to the data-taking computer. I'm sure I > could bodge something together using a seperate program and files on disk or > ramdisk, but this would be slow and klunky on my platform and anyway I'd > prefer to have something fully integrated. > > What I had in mind was to use a stub widget which would use CALL_EXTERNAL > to call an asynchronous I/O routine written in C whose completion routine > would then insert an event into the IDL event queue, telling the instrument > control base widget that the data was ready to collect. The main program > could get on with plotting and analysing earlier data until the transfer was > complete. I have not yet tried the stub widget method, inserting events into the IDL event queue, although it is on my list of things to do. However, you can emulate this behavior without too much trouble. - Make one of your base widgets generate timer events to enter an IDL "polling" routine. This routine polls the C code (via CALL_EXTERNAL) several times per second to see if the device is ready. The C code need not actually poll the device if asynchronous I/O is supported - it can simply maintain a flag indicating that the device has asynchronously reported that data are available. - If there is data ready your timer event routine can read it directly, or it can send an event to another IDL widget informing it that there is data ready. I have used this method for many projects of exactly the type you describe. _______________________________…
creator: rivers
date: 1995-12-21T08:00:00-00:00