National Instruments 320682C Musical Toy Instrument User Manual


 
GPIB/GPIB-488.2 Library Chapter 4
LabWindows/CVI Standard Libraries 4-20 © National Instruments Corporation
If invoked because an asynchronous I/O operation (started by ibrda, ibwrta, or ibcmda)
completed, the callback function should contain the following call:
ibwait (boardOrDevice, TIMO | CMPL);
The ibcnt and ibcntl status variables are not updated until this call to ibwait is made.
Restrictions on Operations in Asynchronous Callbacks
Callbacks installed with ibnotify can be called at any time while your program is running.
You do not have to allow the system to process events. Because of this, you are restricted in what
you can do in the callback. You can do the following:
Call the User Interface Library PostDeferredCall function, which schedules a different
callback function to be called synchronously.
Call any GPIB function, except ibnotify or ibInstallCallback.
Manipulate global variables, but only if you know that the callback has not been called at a
point when the main part of your program is modifying or interrogating the same global
variables.
Call ANSI C functions such as strcpy and sprintf, which affect only the arguments
passed in (that is, have no side effects). You cannot call printf or file I/O functions.
Call malloc, calloc, realloc, or free.
If you need to perform operations that fall outside these restrictions, do the following.
1. In your asynchronous callback, perform the time-critical operations in the asynchronous
callback, and call PostDeferredCall to schedule a synchronous callback.
2. In the synchronous callback, perform the other operations.
See Also
ibInstallCallback