National Instruments NI-488.2 User Manual page 77

National instruments user manual ni-488.2
Hide thumbs Also See for NI-488.2:
Table of Contents

Advertisement

Chapter 7
NI-488.2 Programming Techniques
Note
If you are using
Notification in Win32 NI-488.2 Applications
callback is executed in a separate thread that is created by the NI-488.2 driver. Therefore,
if your application makes NI-488.2 calls from the
NI-488.2 calls from other places, you must use the
ThreadIbcnt
per-process NI-488.2 globals.
NI-488.2 User Manual for Windows
modified by the call. For more information about the use of synchronization
primitives, refer to the documentation about using Win32 synchronization
objects that came with your development tools.
If you choose not to use process-global variables, you can access per-thread
copies of the NI-488.2 global variables using a special set of NI-488.2 calls.
Whenever a thread makes a NI-488.2 call, the driver keeps a private copy
of the NI-488.2 globals for that thread. The driver keeps a separate private
copy for each thread. The following code shows the set of functions you can
use to access these per-thread NI-488.2 global variables:
int ThreadIbsta();
int ThreadIberr();
int ThreadIbcnt();
long ThreadIbcntl(); // return thread-specific ibcntl
In your application, instead of accessing the per-process NI-488.2 globals,
substitute a call to get the corresponding per-thread NI-488.2 global. For
example, the following line of code,
if (ibsta & ERR)
could be replaced by,
if (ThreadIbsta() & ERR)
A quick way to convert your application to use per-thread NI-488.2 globals
is to add the following
#define ibsta
ThreadIbsta()
#define iberr
ThreadIberr()
#define ibcnt
ThreadIbcnt()
#define ibcntl ThreadIbcntl()
in your application (see the
ibnotify
, and
ThreadIbcntl
// return thread-specific ibsta
// return thread-specific iberr
// return thread-specific ibcnt
lines at the top of your C file:
#define
section of this chapter), the
ibnotify
ThreadIbsta
functions described in this section, instead of the
7-10
Asynchronous Event
ibnotify
callback function and makes
,
,
ThreadIberr
www.natinst.com

Advertisement

Table of Contents
loading

Table of Contents