The operating system manages a message queue for CVI applications. When the OS detects events it will place a message in this queue. In CVI, RunUserInterface manages this queue and will poll for new messages in the queue. RunUserInterface relies on the ProcessSystemEvents function, which examines new messages and determines how to handle them. ProcessSystemEvents will also determine the appropriate callback function to be called.
If you are spending too much time in a callback function, RunUserInterface will be suspended and will not be able to process events as they come in. In most cases you will want to keep the code in a callback function minimal. You can multithread your application and use thread safe queues to pass a message from your callback funt
ion to another thread. If you must spend lots of time in your callback function, then you will want to explicitly call ProcessSystemEvents from time to time.
As for the speep policy, I would set it to "do not sleep" mode in order to give CVI the bulk of your system's processor time. Your response in software will also be very system dependent. Speed of CPU, other applications running, etc.
Your timing resolution will be in the order of tenths of milliseconds to milliseconds in software.
Regards,
Justin Britten
Applications Engineer
National Instruments