I am trying to add a callback using g_timeout_add ( timevalue , Func, values passed in Func) to get some status or print something after timevalue.
I am not able to see it. Do I have to call a main loop also?
OR any other type of function to get it working ?
g_timeout_add
is a wrapper for creating a GSouce
which will be used/worked on in the mainloop. So commonly a GMainLoop
is run, or in more complex cases, g_main_loop_iteration
(or similar) is called in a loop.
Yes, you need a main-loop as well. This can be either implicit (e.g. in a gtk+ app it's created for you), or explicitly (use g_main_loop_new and g_main_loop_run), ie:
loop = g_main_loop_new (NULL, TRUE)
g_timeout_add ( ... )
g_main_loop_run (loop)
...