-
Notifications
You must be signed in to change notification settings - Fork 6.9k
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
syscall for socketpair(2) #24366
Comments
I wouldn't call it a "typical" way.
Sounds good. Would give even more weight to the proposal if you gave example of application(s) which could be ported using it. |
@pfalcon - I often use it as a means of cancelling a worker thread where sockets are used with select(2) or poll(2). If you add one end of the socketpair to readfds or pollfds, then it will unblock a blocking select or poll. |
Then I'd suggest to look into #22863 , and help to review/test it. eventfd() would be much more efficient way to signal events (vs passing data) between threads. |
Interesting. Yeah, I guess eventfd() would satisfy my criteria, although it is 100% Linux specific / not portable to other OS's (AFAIK). The nice thing about socketpair() is that it is POSIX and pulled in with It seems eventfd also only supports writing I do think that a pipe(2) implementation would be nice for Zephyr too.. Personally, I don't think having more options is a bad thing. |
To the best of my knowledge, yes.
I'd say the basic function of eventfd is to just get out of poll() call. In such usage, you could (almost) always just fallback to (simple) pipe() call. Passing any data is an extra, advanced feature (well, still achievable with pipe() of course).
+1
I think so too, but:
There was also p.4, but I forgot what it was, and hopefully it won't apply to your PRs ;-). Thanks! |
Working: * non-blocking reads / writes * blocking reads / writes * send(2) / recv(2) / sendto(2) / recvfrom(2) / sendmsg(2) * select(2) * poll(2) Fixes #24366 Signed-off-by: Christopher Friedt <chrisfriedt@gmail.com>
Tests for issue #24366 Signed-off-by: Christopher Friedt <chrisfriedt@gmail.com>
Working: * non-blocking reads / writes * blocking reads / writes * send(2) / recv(2) / sendto(2) / recvfrom(2) / sendmsg(2) * select(2) * poll(2) Fixes zephyrproject-rtos#24366 Signed-off-by: Christopher Friedt <chrisfriedt@gmail.com>
Tests for issue zephyrproject-rtos#24366 Signed-off-by: Christopher Friedt <chrisfriedt@gmail.com>
Is your enhancement proposal related to a problem? Please describe.
A typical means of inter-thread communication is to use a socket pair.
Although it may be a slightly heavyweight method of inter-thread communication for Zephyr, it would facilitate porting applications.
Describe the solution you'd like
I would like to see an implementation of socketpair(2) in Zephyr.
Describe alternatives you've considered
Additional context
The text was updated successfully, but these errors were encountered: