Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SR-6124] [Help wanted][FreeBSD] Issue understanding libdispatch runloop poking #672

Closed
swift-ci opened this issue Oct 12, 2017 · 1 comment

Comments

@swift-ci
Copy link

Previous ID SR-6124
Radar None
Original Reporter Rogiel (JIRA User)
Type Bug
Status Closed
Resolution Done
Additional Detail from JIRA
Votes 0
Component/s libdispatch
Labels Bug
Assignee None
Priority Medium

md5: f6a74df6aa0dabbe1f772fb2ec332db3

Issue Description:

I am trying to get libdispatch working on FreeBSD but I am hitting a wall: I cannot get my head around how the runloop implementation dispatches a event to the kqueue once a new job is submitted. So far I was able to get the library to fully compile but most tests are timing out due to a issue getting the kqueue event handler to awake when the poke method is called.

Looking at the Linux implementation (https://github.com/apple/swift-corelibs-libdispatch/blob/master/src/queue.c#L6119) it appears to be creating a new eventfd descriptor and calls eventfd_write on the poke method. A eventfd_read call is only made in the event_epoll.c implementation file BUT I am unable to find where the specific fd (created in queue.c) is forwarded to the epool handler. In other words, how is the event queue implementation informed of that file descriptor?

On the Darwin side of things, it appears to use a mix of kqueue (on the event handling side) and mach ports (on the signaling side), but i still cannot understand how the event_kevent.c implementation becomes aware of that port allocated on queue.c.

In order do get dispatch working on FreeBSD I need to be able to understand the flow that happens between _dispatch_runloop_queue_class_poke * and a event getting fired in the kqueue implementation (which I believe should be happening in _dispatch_kq_poll*).

EDIT: typos

@swift-ci
Copy link
Author

Comment by Pierre Habouzit (JIRA)

swift corelibs dev is where you should ask questions.

The equivalent of the eventfd on kevent systems is to use an EVFILT_USER. It is very likely that the current implementation using kevent is badly broken on FreeBSD it has never run for a very long time. I have no access to FreeBSD at this time to help though but I can help with questions on the list. Don't hesitate to Cc me explicitly for me not to miss the mail (phabouzit AT .com)

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@shahmishal shahmishal transferred this issue from apple/swift May 5, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant