Ticket #2568 (closed enhancement: fixed)
[PATCH] Implement sched_yield
| Reported by: | andreasf | Owned by: | axeld |
|---|---|---|---|
| Priority: | normal | Milestone: | R1 |
| Component: | - General | Version: | R1/pre-alpha1 |
| Keywords: | Cc: | ||
| Blocked By: | Has a Patch: | no | |
| Platform: | All | Blocking: |
Description
Haiku does not have a sched.h header and the sched_yield function.
It appears to be an optional POSIX feature.
Attachments
Change History
comment:2 Changed 2 years ago by andreasf
Attached is a first shot at implementing it. It compiles but is still untested.
I have no idea if the syscall does the correct thing...
comment:3 Changed 2 years ago by axeld
"os" always means OS APIs, not POSIX APIs. So os/scheduler.c and os/kernel/schduler.h is not where this would be added. Since this is a POSIX feature, it should be put into libroot/posix/sched.c[pp] and headers/posix/sched.h. The syscall looks good.
comment:4 Changed 2 years ago by axeld
Oh, BTW, our coding style wants two blank lines between functions (ie. in scheduler.c of your patch).
comment:5 Changed 2 years ago by andreasf
Okay, I just didn't want to mix my code into GPL'ed glibc files. A headers/posix/sched.h file was already part of the patch.
Actually I didn't yet read the coding guidelines at all... The existing scheduler.c file is wrong then. ;)
comment:6 Changed 2 years ago by andreasf
Patch updated to use a new libroot/posix/scheduler.cpp file. Compiles okay, untested.
With the previous version (and my workarounds reverted), Mono did link okay. No noticable behavioral change.
comment:7 Changed 2 years ago by andreasf
- Summary changed from Implement sched_yield to [PATCH] Implement sched_yield
Still links and runs as before.
comment:8 Changed 2 years ago by axeld
Looks good, do you mind if I remove the /X11 license part? It looks a bit pointless to me.
comment:10 Changed 2 years ago by axeld
- Status changed from new to closed
- Resolution set to fixed
Thanks! I've applied it in r26820.


I'd be interested to help implementing it. Would libroot/os/scheduler.c be a suitable place for it?