Re: Comedi and thread-safety

Well. I've programmed my driver so that it signals EBUSY while a command 
is running or another situation arises which can be managed in parallel.

The trouble with USB is that the user can disconnect the device whenever 
he/she wants. The order of events is quite unpredictable. Even with one 
processor you have multithreading under 2.6.

/Bernd

www:    http://www.berndporr.me.uk/
         http://www.linux-usb-daq.co.uk/
Mobile: +44 (0)7840 340069
Work:   +44 (0)141 330 5237
         University of Glasgow
         Department of Electronics & Electrical Engineering
         Room 519, Rankine Building, Oakfield Avenue,
         Glasgow, G12 8LT


Jan Gukelberger wrote:
> Hi,
> 
> there were some posts regarding this topic about a year ago:
> https://cvs.comedi.org/pipermail/comedi/2003-March/004302.html
> 
> These make me believe that I don't have to expect problems if I
> serialise access to specific subdevices each with a mutex. (Use
> pthread_mutex or comedi_lock()? Does comedi_lock() on a locked subdev
> wait for the lock to be released or does it return EBUSY?) 
> Parallel access to different subdevices should be all right. Right?
> 
> Or would it be even safe to e.g. comedi_read() one subdevice with
> several threads in parallel? Probably not?
> 
> Oh, and one more question: What operations can be performed on a
> subdevice while a comedi_command e.g. for recording is in progress?
> 
> Any comment by someone with knowledge of the code or own experience with
> multithreaded comedi programs would be greatly appreciated.
> 
> Thanks,
> Jan
> 
> 
> _______________________________________________
> comedi mailing list
> comedi_at_comedi.org
> https://cvs.comedi.org/cgi-bin/mailman/listinfo/comedi

Received on 2005-03-04Z15:43:35