libftdi Archives

Subject: Re: libftdi 0.x thread recommendations

From: Rogier Wolff <R.E.Wolff@xxxxxxxxxxxx>
To: libftdi@xxxxxxxxxxxxxxxxxxxxxxx
Cc: Thomas Heller <theller@xxxxxxxxxx>
Date: Wed, 25 Apr 2012 10:35:56 +0200
On Wed, Apr 25, 2012 at 09:29:51AM +0200, Thomas Jarosch wrote:
> That should work. You still have to use proper locking if f.e.
> a "background" thread collects data via ftdi_read_data() and you also
> call ftdi_read_data() from the "main" thread. (Multi core systems
> might see different values for ftdi->readbufer_XXX otherwise)

Is it safe to have a "reading" thread that does all the reading, while
another thread does some writing? My reading-thread dumps the data
into a properly locked (*) shared memory buffer and the "main" thread
reads from there.

        Roger. 

(*) Actually no locks involved. If you program it wisely there is no
need.

-- 
** R.E.Wolff@xxxxxxxxxxxx ** http://www.BitWizard.nl/ ** +31-15-2600998 **
**    Delftechpark 26 2628 XH  Delft, The Netherlands. KVK: 27239233    **
*-- BitWizard writes Linux device drivers for any device you may have! --*
The plan was simple, like my brother-in-law Phil. But unlike
Phil, this plan just might work.

--
libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to libftdi+unsubscribe@xxxxxxxxxxxxxxxxxxxxxxx   

Current Thread