Does your read need to actively grab data all the time, or can you set a callback that will notify you when a chunk is ready? If the latter is true, then a wait/notify pair might be all you'd need (suitably wrapped in a @sync/@async block). For the former, then two Julia processes might be the better way to go. In neither case is it obvious that you require C, although there are circumstances where that would be best. In case it's relevant to your situation, I posted an example to this list just a short while ago about wait/notify where the callback was being issued from a separate thread. (Having it be issued from a separate thread makes life significantly trickier; if that doesn't apply, your life will be simpler.)
I'm working on some stuff that's conceptually similar to this, and I have to say that the combination of @sync/@async, multiple processes, and SharedArrays makes this kind of thing quite pleasant and straightforward. We're getting closer to nirvana all the time... --Tim On Friday, February 07, 2014 02:01:41 PM Elliot Saba wrote: > I'm writing a librtlsdr wrapper for recording off of a > software-defined-radio USB dongle right now, and I want to have a > background thread (or analogue) for recording data from the dongle. What's > the best way to do that in Julia? > > Right now, I'm considering just creating a small C program to do the > reading for me, and dumping the data into Julia using UDP sockets or > something. (Thanks Keno for the recent UDP work. :) ) This would also > simplify my eventual aim to support multiple USB dongles at once, I think. > > Any other ideas on how to do this properly? Thanks! > -E
