mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2026-02-08 11:23:17 +08:00
[libc]优化usleep函数
This commit is contained in:
committed by
Man, Jianting (Meco)
parent
38eb3fc40f
commit
b9f5bf7d91
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||
* Copyright (c) 2006-2023, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
@@ -66,12 +66,12 @@ int usleep(useconds_t usec)
|
||||
if (rt_thread_self() != RT_NULL)
|
||||
{
|
||||
msleep(usec / 1000u);
|
||||
udelay(usec % 1000u);
|
||||
}
|
||||
else /* scheduler has not run yet */
|
||||
{
|
||||
udelay(usec / 1000u * 1000u);
|
||||
udelay(usec);
|
||||
}
|
||||
udelay(usec % 1000u);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user