diff options
author | Raul E Rangel <rrangel@chromium.org> | 2021-07-15 11:48:48 -0600 |
---|---|---|
committer | Martin Roth <martinroth@google.com> | 2021-07-18 00:25:29 +0000 |
commit | d5dca21a958001a555b9a313156567f0bdec643b (patch) | |
tree | cf72c05bd55a989f268cfd1a930a837462598ef9 /src/include | |
parent | d373d5d92f872e59248d4bd7225ae80616100f35 (diff) |
lib/thread: Add thread_yield helper method
This helper method is just a shorthand for
`thread_yield_microseconds(0)`. I think it makes it clear that we want
to yield a thread without delaying.
BUG=b:179699789
TEST=build test
Suggested-by: Julius Werner <jwerner@chromium.org>
Signed-off-by: Raul E Rangel <rrangel@chromium.org>
Change-Id: Id8b60c35b183cff6871d7ba70b36eb33b136c735
Reviewed-on: https://review.coreboot.org/c/coreboot/+/56349
Reviewed-by: Karthik Ramasubramanian <kramasub@google.com>
Reviewed-by: Furquan Shaikh <furquan@google.com>
Reviewed-by: Julius Werner <jwerner@chromium.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/thread.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/include/thread.h b/src/include/thread.h index da8ed721e3..6df9d7edc5 100644 --- a/src/include/thread.h +++ b/src/include/thread.h @@ -33,6 +33,10 @@ int thread_run(void (*func)(void *), void *arg); * machine. */ int thread_run_until(void (*func)(void *), void *arg, boot_state_t state, boot_state_sequence_t seq); + +/* Return 0 on successful yield, < 0 when thread did not yield. */ +int thread_yield(void); + /* Return 0 on successful yield for the given amount of time, < 0 when thread * did not yield. */ int thread_yield_microseconds(unsigned int microsecs); @@ -64,6 +68,10 @@ static inline int thread_run_until(void (*func)(void *), void *arg, boot_state_t { return -1; } +static inline int thread_yield(void) +{ + return -1; +} static inline int thread_yield_microseconds(unsigned int microsecs) { return -1; |