[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: libdispatch: blocks on main queue does not execute
From: |
David Chisnall |
Subject: |
Re: libdispatch: blocks on main queue does not execute |
Date: |
Fri, 27 Dec 2013 10:19:53 +0000 |
Hi Johannes,
Yes, this is a known limitation. GNUstep has a runloop implementation that
predates libdispatch and, although we can optionally use libdispatch for some
things (e.g. array iteration). The fix for this would be to implement a new
GSRunLoopCtx that used libdispatch. This is quite attractive for FreeBSD, as
it would mean that we'd get kqueue usage as well, rather than select() or
poll() (last time I asked about this, no one [including me] had any
applications that had enough open event sources to worry about the bottleneck,
so it moved down my todo list).
In particular, this will require modifying the way NSTimer works, so that it
just registers for the timer event. It would be nice to abstract that a little
bit, as Linux now has timerfd, which can work in a similar way with the
existing poll() / select() code.
David
P.S. Have we set you up with commit access for GNUstep yet?
On 27 Dec 2013, at 06:27, Lundberg, Johannes <johannes@brilliantservice.co.jp>
wrote:
> Hi
>
> I'm a big fan of dispatch and blocks. For iOS development I often use the
> pattern
>
> dispatch_async(dispatch_get_global_queue(0,0), ^{
> // do some time consuming task
> dispatch_async(dispatch_get_main_queue(), ^{
> // update ui
> });
> });
>
> However, this does not work on GNUstep/FreeBSD.
> Blocks put on global queues execute fine. Blocks on main queue does not
> execute.
>
> Not even
> dispatch_async(dispatch_get_main_queue(), ^{
> NSLog(@"Test..");
> });
> from main thread/queue works.
>
> Reading the documentation there seem to be a
> dispatch_main()
> call required to execute blocks on main queue.
> If I add this call after the above the blocks on the main queue executes just
> fine, however, the code freezes there.
> As it says:
> * This function "parks" the main thread and waits for blocks to be submitted
> * to the main queue. This function never returns.
> * Applications that call NSApplicationMain() or CFRunLoopRun() on the
> * main thread do not need to call dispatch_main().
>
> This makes me think that there is something missing in GNUstep compared to
> Cocoa's NSRunLoop to enable this.
>
> Anyone have any idea about this?
>
> --
> Johannes Lundberg
>
>
> =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
> 秘密保持について:この電子メールは、名宛人に送信したものであり、秘匿特権の対象となる情報を含んでいます。
> もし、名宛人以外の方が受信された場合、このメールの破棄、およびこのメールに関する一切の開示、
> 複写、配布、その他の利用、または記載内容に基づくいかなる行動もされないようお願い申し上げます。
> ---
> CONFIDENTIALITY NOTE: The information in this email is confidential
> and intended solely for the addressee.
> Disclosure, copying, distribution or any other action of use of this
> email by person other than intended recipient, is prohibited.
> If you are not the intended recipient and have received this email in
> error, please destroy the original
> message._______________________________________________
> Discuss-gnustep mailing list
> Discuss-gnustep@gnu.org
> https://lists.gnu.org/mailman/listinfo/discuss-gnustep
-- Sent from my STANTEC-ZEBRA