Is the SUB-20 libraryTHREAD SAFE ...??

All about Sub-20 Multi Interface USB Adapter USB to I2C, SPI, GPIO, RS232, RS485, Ir, LCD

Moderator: serg

Post Reply
soumajit
Posts: 12
Joined: Thu Feb 03, 2011 3:26 am

Is the SUB-20 libraryTHREAD SAFE ...??

Post by soumajit »

Hello everyone, i am working with the SUB-20 adapter and want to use multi-threaded programming. I have read the libraries and found that there are many global and static variables. So i wanted to make sure if it is thread safe. I don't see a mention of thread safety anywhere in the documentation though. Kindly help!!.

xol
Site Admin
Posts: 241
Joined: Sat Aug 29, 2009 8:04 am

Re: Is the SUB-20 libraryTHREAD SAFE ...??

Post by xol »

Hi,
What operating system are you going to use?
And what kind of API requests?

You need to understand that USB system is not multi-thread/multi-process oriented. USB device can not perform a number of request at the same time.

soumajit
Posts: 12
Joined: Thu Feb 03, 2011 3:26 am

Re: Is the SUB-20 libraryTHREAD SAFE ...??

Post by soumajit »

xol wrote:Hi,
What operating system are you going to use?
And what kind of API requests?

You need to understand that USB system is not multi-thread/multi-process oriented. USB device can not perform a number of request at the same time.
Hey thank you for the reply,
Well i am using linux(ubuntu10.10) and basically i have a scenario where i have to read GPIO and SPI using two different threads. I am aware that the SUB-20 will process these requests sequentially but my program involves receiving simultaneous messages. So how can i proceed? :D

xol
Site Admin
Posts: 241
Joined: Sat Aug 29, 2009 8:04 am

Re: Is the SUB-20 libraryTHREAD SAFE ...??

Post by xol »

Hi,
Under Linux we use libusb 1.x, which is multithreded with some considerations mentioned here: http://libusb.sourceforge.net/api-1.0/mtasync.html

For us if you care to serialize SUB-20 API calls, which means next API call waits for termination of the previous call, we have no problems.

soumajit
Posts: 12
Joined: Thu Feb 03, 2011 3:26 am

Re: Is the SUB-20 libraryTHREAD SAFE ...??

Post by soumajit »

thanks for the info. and the sourceforge document it is of great help.

Post Reply