Skip to content

Commit

Permalink
NonStop: Do not call sleep() with a 0 value
Browse files Browse the repository at this point in the history
This change ensures that sleep(0) is not invoked to cause unexpected
duplicate thread context switches when _REENTRANT is specified.

Fixes: #24009

Signed-off-by: Randall S. Becker <randall.becker@nexbridge.ca>

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from #24012)

(cherry picked from commit c89fe57)
  • Loading branch information
rsbeckerca authored and t8m committed Apr 5, 2024
1 parent a19553c commit 0d2a5f6
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion crypto/sleep.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ void OSSL_sleep(uint64_t millis)
unsigned int s = (unsigned int)(millis / 1000);
unsigned int us = (unsigned int)((millis % 1000) * 1000);

sleep(s);
if (s > 0)
sleep(s);
usleep(us);
# endif
}
Expand Down

0 comments on commit 0d2a5f6

Please sign in to comment.