diff --git a/libmaxsi/c/hsrc/unistd.h b/libmaxsi/c/hsrc/unistd.h index 5ae24953..6d794ebf 100644 --- a/libmaxsi/c/hsrc/unistd.h +++ b/libmaxsi/c/hsrc/unistd.h @@ -165,9 +165,10 @@ int isatty(int); int pipe(int [2]); ssize_t read(int, void*, size_t); unsigned sleep(unsigned); -#if __POSIX_OBSOLETE <= 200112 +/*#if __POSIX_OBSOLETE <= 200112*/ +typedef unsigned int useconds_t; int usleep(useconds_t useconds); -#endif +/*#endif*/ int unlink(const char*); ssize_t write(int, const void*, size_t); diff --git a/sortix/scheduler.cpp b/sortix/scheduler.cpp index 34afcd87..14636ce6 100644 --- a/sortix/scheduler.cpp +++ b/sortix/scheduler.cpp @@ -319,7 +319,12 @@ namespace Sortix { Thread* thread = currentthread; uintmax_t timetosleep = ((uintmax_t) secs) * 1000ULL * 1000ULL; - if ( timetosleep == 0 ) { return; } + if ( timetosleep == 0 ) + { + Switch(Syscall::InterruptRegs()); + Syscall::AsIs(); + return; + } PutThreadToSleep(thread, timetosleep); Syscall::Incomplete(); } @@ -328,7 +333,12 @@ namespace Sortix { Thread* thread = currentthread; uintmax_t timetosleep = usecs; - if ( timetosleep == 0 ) { return; } + if ( timetosleep == 0 ) + { + Switch(Syscall::InterruptRegs()); + Syscall::AsIs(); + return; + } PutThreadToSleep(thread, timetosleep); Syscall::Incomplete(); }