Opened 16 years ago

Closed 16 years ago

#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: Blocking:
Platform: All

Description

Haiku does not have a sched.h header and the sched_yield function.

It appears to be an optional POSIX feature.

Attachments (2)

sched_yield-01.diff (1.5 KB ) - added by andreasf 16 years ago.
Draft patch
sched_yield-02.diff (1.3 KB ) - added by andreasf 16 years ago.
Draft patch

Download all attachments as: .zip

Change History (12)

comment:1 by andreasf, 16 years ago

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

by andreasf, 16 years ago

Attachment: sched_yield-01.diff added

Draft patch

comment:2 by andreasf, 16 years ago

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 by axeld, 16 years ago

"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 by axeld, 16 years ago

Oh, BTW, our coding style wants two blank lines between functions (ie. in scheduler.c of your patch).

comment:5 by andreasf, 16 years ago

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. ;)

by andreasf, 16 years ago

Attachment: sched_yield-02.diff added

Draft patch

comment:6 by andreasf, 16 years ago

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 by andreasf, 16 years ago

Summary: Implement sched_yield[PATCH] Implement sched_yield

Still links and runs as before.

comment:8 by axeld, 16 years ago

Looks good, do you mind if I remove the /X11 license part? It looks a bit pointless to me.

comment:9 by andreasf, 16 years ago

Go ahead, I'm just used to it from other projects.

comment:10 by axeld, 16 years ago

Resolution: fixed
Status: newclosed

Thanks! I've applied it in hrev26820.

Note: See TracTickets for help on using tickets.