[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Iterating Glib's GMainLoop with NSRunLoop
From: |
Hugo Melder |
Subject: |
Iterating Glib's GMainLoop with NSRunLoop |
Date: |
Tue, 5 Sep 2023 15:28:39 +0200 |
Hey,
I am currently using GStreamer as part of a project, and started using
Objective-C for non-GStreamer components of the application.
The loads of macros and boilerplate were just to much…
However, I am currently stuck at integrating (At the moment only iterating) the
Glib mainloop.
The Glib provides the GMainLoop, which is similar to NSRunLoop and can be
manually iterated:
loop->is_running = TRUE;
while (loop->is_running)
{
g_main_context_iteration (context, TRUE);
}
The second argument of g_main_context_iteration indicates whether the iteration
should block.
I thought about using an NSTimer with a high polling frequency, but that seems
like a hack to me. Is there a better way (maybe even a GNUstep specific one) to
install a hook into the runloop? The RunLoop Observer APIs does not seem to be
available with GNUstep’s NSRunLoop implementation.
Writing a GMainLoop compatible “class”, and bridging to the NSRunLoop by
translating all Glib Events would be a more complex solution.
Any ideas or tips are welcome :)
Best Regards,
Hugo
- Iterating Glib's GMainLoop with NSRunLoop,
Hugo Melder <=