discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

AppKit, libdispatch and 100% CPU


From: Tom Sheffler
Subject: AppKit, libdispatch and 100% CPU
Date: Tue, 22 Aug 2023 08:37:24 -0700

I've recently ventured into combining AppKit with libdispatch.  Previously, I've successfully used libs-base with libdispatch and [NSRunLoop run] and it all works fine and does not exhibit the symptom I am observing.

In an app that creates a window with AppKit and calls dispatch_async(dispatch_get_main_queue, ...) I am seeing the CPU spike to 100% when nothing is happening.  I first noticed in a small program that had a background queue that wanted to update the display.  But I have managed to illustrate the issue in a very simple program here:

https://github.com/sheffler/gnustep-rowcol-layout-examples/tree/main/10-manual-layout

I have compiled this on Ubuntu, raspberry-pi and onflapp's gs-desktop with Debian and see the same thing.  If I remove calls to dispatch_async() entirely, there is no issue, but after the first call, the CPU spikes.

I've also noticed that the CPU usage drops when the widgets in the window are being manipulated.  The app is performant regardless, but when nothing is happening it uses 100%.  

Has anyone else seen this?  Should it work?  Or am I misunderstanding.

Thanks,
Tom


reply via email to

[Prev in Thread] Current Thread [Next in Thread]