[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Iterating Glib's GMainLoop with NSRunLoop
From: |
Ondrej Florian |
Subject: |
Re: Iterating Glib's GMainLoop with NSRunLoop |
Date: |
Wed, 06 Sep 2023 23:02:17 +0200 |
User-agent: |
GNUMail (Version 1.4.0) |
Hi Hugo,
using timer is not that bad and it has been used in the wild.
For example:
https://github.com/onflapp/nextspace/blob/master/Frameworks/SystemKit/OSEUDisksAdaptor.m
On 2023-09-05 15:28:39 +0200 Hugo Melder <admin@hugomelder.com> wrote:
> 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
>
>