SCHED_YIELD(3P)

πŸ’– SCHED_YIELD(3P) πŸ’–

okay bestie, so this is a page from the POSIX Programmer's Manual (that's the manual, right there in the name πŸŽ€), and before we even get into it you gotta know something, okay?

PROLOG β€” This manual page is part of the POSIX Programmer's Manual. The Linux implementation of this interface may differ (consult the corresponding Linux manual page for details of Linux behavior), or the interface may not be implemented on Linux.

like. read that again. the Linux version might be doing its own little thing, so if you're on Linux, go check the Linux manpage too. no cap. πŸ™ˆ


✨ NAME ✨

sched_yield β€” yield the processor

it's giving "ma'am, it's not your turn anymore" πŸ’…


🌸 SYNOPSIS 🌸

#include <sched.h>

int sched_yield(void);

πŸ¦‹ DESCRIPTION πŸ¦‹

okay so sched_yield() is literally the politest function in the whole scheduler. The sched_yield() function shall force the running thread to relinquish the processor until it again becomes the head of its thread list.

and the way that it takes no arguments? iconic. zero args. it just walks up, says "you know what, someone else can go," and steps aside. queen behavior honestly πŸ‘‘


πŸ’… RETURN VALUE πŸ’…

The sched_yield() function shall return 0 if it completes successfully; otherwise, it shall return a value of -1 and set errno to indicate the error.

so 0 = slay, -1 = uh oh check errno bestie 😭


🌈 ERRORS 🌈

No errors are defined.

yup. that's it. nothing. the error section is empty like my calendar on a Friday night πŸ’€

The following sections are informative.


πŸ“ EXAMPLES πŸ“

None.

not a single one. the examples section said "no thoughts, head empty" 🧚


πŸ’œ APPLICATION USAGE πŸ’œ

okay this part is the real tea, so listen up 🫢

The conceptual model for scheduling semantics in POSIX.1‐2008 defines a set of thread lists. This set of thread lists is always present regardless of the scheduling options supported by the system.

and here's the important bit for your portable code: On a system where the Process Scheduling option is not supported, portable applications should not make any assumptions regarding whether threads from other processes will be on the same thread list.

tl;dr β€” if the system doesn't support the Process Scheduling option, do not assume anything about whose threads are chillin' on the same thread list. assume nothing. that's the vibe check. πŸ’€

πŸ‘‘ RATIONALE πŸ‘‘

None.

nope. nothing here. moving on bestie πŸ’…


⭐ FUTURE DIRECTIONS ⭐

None.

the future is... also empty. periodt.


πŸ”₯ SEE ALSO πŸ”₯

  • The Base Definitions volume of POSIX.1‐2017, <sched.h>

go read the header, iykyk πŸŽ€


okay this is the legal bit, and we do NOT skip the legal bit, bestie, we read it with respect 🫢

Portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1-2017, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 7, 2018 Edition, Copyright (C) 2018 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html .

Any typographical or formatting errors that appear in this page are most likely to have been introduced during the conversion of the source files to man page format. To report such errors, see https://www.kernel.org/doc/man-pages/reporting_bugs.html .


and that's the whole page, bestie!! πŸŽ€βœ¨ this one came to you from IEEE/The Open Group, 2017 β€” that's the source and the date right there β€” and it's the SCHED_YIELD(3P) page, so now you know exactly how to be the most gracious thread in the whole thread list πŸ’– bye ily 🫢

πŸ“¦ where this page comes from