Soletta machine learning
Machine learning for IoT devices
 All Data Structures Files Functions Typedefs Enumerations Enumerator Groups Pages
Functions
Mainloop

The sml_main_loop is responsible for providing a mainloop using glib's mainloop. It is also possible to schedule a timer to automatically call sml_process. More...

Functions

int sml_main_loop_init (void)
 Init the SML mainloop. More...
 
void sml_main_loop_quit (void)
 Stops the SML mainloop. More...
 
void sml_main_loop_run (void)
 Start the SML mainloop. More...
 
int sml_main_loop_schedule_sml_process (struct sml_object *sml, unsigned int timeout)
 Schedule a timer to call sml_process automatically. More...
 
void sml_main_loop_shutdown (void)
 Clean up the SML mainloop. More...
 
bool sml_main_loop_unschedule_sml_process (int sml_timeout_id)
 Unschedule the SML mainloop. More...
 

Detailed Description

The sml_main_loop is responsible for providing a mainloop using glib's mainloop. It is also possible to schedule a timer to automatically call sml_process.

Function Documentation

int sml_main_loop_init ( void  )

Init the SML mainloop.

Remarks
The SML mainloop is refcounted, so the number of calls to sml_main_loop_init must match the number of calls to sml_main_loop_shutdown
Returns
0 on success.
A number < 0 on failure.
See Also
sml_main_loop_shutdown
sml_main_loop_run
void sml_main_loop_quit ( void  )

Stops the SML mainloop.

See Also
sml_main_loop_run
sml_main_loop_shutdown
void sml_main_loop_run ( void  )

Start the SML mainloop.

See Also
sml_main_loop_quit
int sml_main_loop_schedule_sml_process ( struct sml_object sml,
unsigned int  timeout 
)

Schedule a timer to call sml_process automatically.

Parameters
smlThe sml_object object.
timeoutThe interval between sml_process calls (milliseconds).
Returns
A timeout_id on success.
-1 on error.
See Also
sml_process
sml_main_loop_unschedule_sml_process
sml_object
void sml_main_loop_shutdown ( void  )

Clean up the SML mainloop.

See Also
sml_main_loop_init
bool sml_main_loop_unschedule_sml_process ( int  sml_timeout_id)

Unschedule the SML mainloop.

This function will unschedule the sml_process calls.

Parameters
sml_timeout_idThe timeout_id returned by sml_main_loop_schedule_sml_process.
Returns
true on success.
false on failure.
See Also
sml_main_loop_schedule_sml_process
sml_process