FixIO Documentation

Back to summary

C API

Functions

void fixio_register_functions(Heap *heap);
Registers I/O functions to given heap.

Console access

void *fixio_get_console_mutex();
Returns a pointer to the console mutex used to block inappropriate access from other threads. The mutex type is either CRITICAL_SECTION on Windows or pthread_mutex_t on other platforms.
int fixio_is_console_active();
Returns true when the console is active. Must be called with the console mutex locked.
void fixio_flush_console();
Triggers a delayed flushing of the console. When the console is not active it flushes immediatelly. Does nothing on Windows as flushing is not needed. Must be called with the console mutex locked.

Integration with foreign event loop

typedef void (*IOEventNotifyFunc)(void *data);
Notification function type.
void fixio_integrate_event_loop(Heap *heap, IOEventNotifyFunc notify_func, void *notify_data);
Integrates the event loop with an external event loop. This is achieved by waiting on the I/O in another thread. The given callback function is called whenever there is something to process. The callback should pass this information to the foreign loop and once processed the event handler must call the fixio_process_events function to process the I/O events in the main thread.
Note: Only one event loop can be integrated in particular heap and the integration is currently permanent.
void fixio_process_events(Heap *heap);
Processes the I/O events initiated by the callback passed to fixio_integrate_event_loop. This function must not be called at any other time.