chickadee » srfi-18 » thread-yield!


The current thread exits the running state as if its quantum had expired. thread-yield! returns an unspecified value.

    ; a busy loop that avoids being too wasteful of the CPU
    (let loop ()
      (if (mutex-lock! m 0) ; try to lock m but don't block
            (display "locked mutex m")
            (mutex-unlock! m))
            (thread-yield!) ; relinquish rest of quantum