SCHED_YIELD(2)

✨ SCHED_YIELD(2) ✨

okay bestie, welcome to the system calls manual page for sched_yield β€” yes the title is literally SCHED_YIELD(2), section 2, we love a numbered girlie πŸ’…


πŸŽ€ NAME πŸŽ€

sched_yield β€” yield processor 🫢


πŸ“š LIBRARY πŸ“š

Standard C Library (libc, -lc) β€” she lives in the classic C library, iconic behavior ✨


πŸ¦‹ SYNOPSIS πŸ¦‹

#include <sched.h>

int
sched_yield(void);

like, that's it. that's the whole call. no arguments, no drama, no nothing πŸ’–


πŸ’« DESCRIPTION πŸ’«

so sched_yield() is a system call and what it does is force the running process to relinquish the processor until it again becomes the head of its process list. it takes no arguments. that's the entire vibe. you're basically tapping out of the CPU for a sec like "no you go ahead bestie, i'll wait my turn" 😌


🌸 RETURN VALUES 🌸

the sched_yield() function returns the value 0 if successful πŸŽ‰ otherwise the value -1 is returned and the global variable errno is set to indicate the error. so yeah, 0 = slay, -1 = uh oh check errno πŸ™ˆ


πŸ’€ ERRORS πŸ’€

on failure errno will be set to the corresponding value:

  • [ENOSYS] β€” the system is not configured to support this functionality. literally the system said "not me, not today" 😭

πŸ‘‘ STANDARDS πŸ‘‘

the sched_yield() system call conforms to IEEE Std 1003.1b-1993 (β€œPOSIX.1”). periodt, certified standard girlie ✨


and that's the whole page fr fr 🫢 this one came from Debian, dated March 12, 1998 β€” yeah she's a 90s baby and she's still out here yielding processors like a legend πŸ‘‘πŸ’– bye bestie, go be the head of your process list πŸ¦‹

πŸ“¦ where this page comes from