Ronald Bultje wrote: > Hi all, > > I've tried to do some threading magic in lavrec... Basically, sync > (VIDIOCSYNC) and queue (VIDIOCMCAPTURE) calls go in different threads. > Problem: I queue all buffers, then sync on each of them, give the buffer > to a different thread and let it re-queue it. After some time (testing, > 100% CPU load, so I can't keep up and have to lose frames...), when my > number of queued buffers starts to decrease to zero and I'm about to > sync on yet-unqueued buffers, I get a -EINV return value ("invalid > argument") on my next VIDIOCSYNC. Yes, of course. > How threadsafe is v4l supposed to be? Shouldn't be a problem. If it is you found a bug in the driver's locking. > Can I sync on unqueued buffers (assuming, of course, that they'll be > queued later on - i.e. I'm losing frames)? You can't. Gerd -- #define ENOCLUE 125 /* userland programmer induced race condition */