SR Research Support Site
Functions
Application/Thread priority control

Functions

INT32 set_application_priority (INT32 priority)
 
void begin_realtime_mode (UINT32 delay)
 
void end_realtime_mode (void)
 
void set_high_priority (void)
 
void set_normal_priority (void)
 
INT32 in_realtime_mode (void)
 

Detailed Description

Function Documentation

void begin_realtime_mode ( UINT32  delay)

Sets the application priority and cleans up pending Windows activity to place the application in realtime mode. This could take up to 100 milliseconds, depending on the operation system, to set the application priority. Use the <delay> value to set the minimum time this function takes, so that this function can act as a useful delay.

Remarks
Under Windows Vista and later, the application need to be run as "Run as Administrator" to get realtime priorities.
Under Linux, the application need to be run as root to get realtime priorities.
@param delay Minimum delay in milliseconds (should be about 100).

\b Example:
<pre>
1 // This program shows the use of begin_realtime_mode() and end_realtime_mode()
2 #include <eyelink.h>
3 
4 int error;
5 
6 // Start data recording to EDF file, BEFORE DISPLAYING STIMULUS
7 error = start_recording(1,1,1,1);
8 if(error != 0) return error; // return error code if failed
9 
10 // Records for 100 msec before displaying stimulus
11 // Sets up for realtime execution (minimum delays)
12 begin_realtime_mode(100);
13 
14 ...
15 // Code for drawing, updating display and process trial loop
16 // including timing, key or button response handling
17 
18 // Exits realtime execution mode
19 end_realtime_mode();
20 
21 ...
22 // Code for trial clean up and exiting
See also
end_realtime_mode()
void end_realtime_mode ( void  )

Returns the application to a priority slightly above normal, to end realtime mode. This function should execute rapidly, but there is the possibility that Windows will allow other tasks to run after this call, causing delays of 1-20 milliseconds.

Remarks
Warning: This function has little or no effect under Windows 95/98/Me.

Example: See begin_realtime_mode()

See also
begin_realtime_mode()
INT32 in_realtime_mode ( void  )

returns whether the current mode is real-time.

Returns
1 if in realtime mode, else 0.
INT32 set_application_priority ( INT32  priority)

Changes the multitasking proirity of current application Using THREAD_PRIORITY_ABOVE_NORMAL may reduce latency Reset priority with THREAD_PRIORITY_NORMAL Too high priority will stop the link from functioning!

void set_high_priority ( void  )

Raise application priority. May interfere with other applications.

void set_normal_priority ( void  )

Sets application priority to system normal


Copyright ©2002-2021, SR Research Ltd.