XEM driver shared among XP processes!


#1

Hi,
Just to let you know the feature that i discovered (involuntarily…:stuck_out_tongue:
Unser XP, you can have more than one process (i tried with 2) accessing simultaneously the same board …
All the init services returns OK and the board accesses work well.

One additional great feature of this material ! :slight_smile:


#2

Yes, you can but you should be careful. If you have them simultaneously running and they collide, you could get unpredictable results.

The methods (like WriteToPipeIn) are not atomic. Some may execute more than one USB transaction when communicating with the board. It is therefore possible that the OS could do a context switch between USB transactions and the methods could stomp on each other.

There is a checkbox in FrontPanel labelled “Enable updates” for this reason. While FrontPanel runs with a connected board, it continually polls for wire/trigger updates. If you have other software running, this polling can stomp on that other software’s use of the API.

This is not an issue when you have two separate processes talking to two different boards.

The better way to do multithreaded access when you need multiple access ot the board is to have a SINGLE process or thread do the communication. All other threads must request access through this semaphore. We’ve used this on projects and it works splendidly and is not very difficult to implement. But the implementation is really application-specific.