Page 1 of 1
Is the SUB-20 libraryTHREAD SAFE ...??
Posted: Fri Feb 04, 2011 5:29 am
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!!.
Re: Is the SUB-20 libraryTHREAD SAFE ...??
Posted: Fri Feb 04, 2011 5:54 am
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.
Re: Is the SUB-20 libraryTHREAD SAFE ...??
Posted: Fri Feb 04, 2011 6:06 am
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?

Re: Is the SUB-20 libraryTHREAD SAFE ...??
Posted: Fri Feb 04, 2011 10:01 am
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.
Re: Is the SUB-20 libraryTHREAD SAFE ...??
Posted: Tue Feb 08, 2011 5:36 am
by soumajit
thanks for the info. and the sourceforge document it is of great help.