<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Dec 11, 2015, at 11:25 AM, Pierre Habouzit via swift-corelibs-dev <<a href="mailto:swift-corelibs-dev@swift.org" class="">swift-corelibs-dev@swift.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class=""><blockquote type="cite" class=""><div class="">On Dec 11, 2015, at 9:57 AM, Pierre Habouzit via swift-corelibs-dev <<a href="mailto:swift-corelibs-dev@swift.org" class="">swift-corelibs-dev@swift.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><blockquote type="cite" class=""><div class=""><br class="Apple-interchange-newline">On Dec 11, 2015, at 9:02 AM, Philippe Hausler via swift-corelibs-dev <<a href="mailto:swift-corelibs-dev@swift.org" class="">swift-corelibs-dev@swift.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">This is only tangentially related: but I was attempting to build dispatch as well to start work on CFRunLoop and a few other dispatch bound features in Foundation on linux. I was seeing similar failures as Dzianis Fedarenka. Is there a branch/fork that I can grab to test this stuff out w/ bringing stuff up in Foundation?</div><div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><br class=""></div><div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">My question is that of design and status of where things are at; CFRunLoop requires a method to interoperate with the main dispatch queue via _dispatch_get_main_queue_port_4CF and _dispatch_main_queue_callback_4CF. CFRunLoop will need to transact upon the same event source type as dispatch to ensure the main queue behaves correctly - so what type of event source should we be using? A socket? A producer/consumer notification via pthread conditions?</div></div></blockquote><div class=""><br class=""></div><div class="">The linux equivalent to what we’re doing for the runloop is to use an eventfd() to replace sending messages to its port.</div></div></div></blockquote><div class=""><br class=""></div>Though the runloop code should be disabled on linux right now, as it’s highly dependent on mach ports, and we should discuss whether having a dispatch queue attached to the runloop makes sense for the non mach version, and if it does, should it have exactly the same queue_runloop implementation as today. I think not, and the simplest way to port the implementation is to have a different implementation for linux completely and not rely on the weird 4CF hooks that we have on OS X.</div><div class=""><br class=""></div><div class="">-Pierre</div></div></div></blockquote><div><br class=""></div><div>We already have a Windows implementation in there that uses HANDLE, so we are not completely dependent on mach ports.</div><div><br class=""></div><div>I think it’s critical for portability that we maintain the concept of dispatch_main and CFRunLoop main thread integration. The exact mechanism is something we can design, but we have a fairly proven pattern here that would be straightforward to port.</div><div><br class=""></div><div>- Tony</div></div><br class=""></body></html>