02-10-2006 12:11 PM
02-12-2006 06:32 PM
I believe you are trying to send GPIB commands at the same time from multiple threads or processes. Normally GPIB and/or VISA driver does process its own mutual exclusion, keeping all the write/read function calls to be serialized. Therefore multiple GPIB commands are never be cross-overlapped.
Other case is that one thread (or process) sends a GPIB command and then reads the response, at the same other thread sends a different GPIB command then reads the response. For example, the thread #1 is querying "*IDN?" and the thread #2 is querying "MEAS:VOLT?". In this case, you should use Lock/Unlock functions to avoid the two query pairs from cross-overlapping. If overlapping, sending "MEAS:VOLT?" command immediately after the "*IDN?" command without reading response will corrupt the IDN response to receive.
The Win32 functions for lock/unlock are Semaphoe, Critical-Section, or Mutex. the VISA library also provides this kind mechanism for multiple VISA sessions that access the same I/O resource at the same time.