删除rt_thread_sleep遗留
This commit is contained in:
parent
3e246caa1c
commit
c90179beb5
|
@ -475,7 +475,7 @@ void rt_demo_thread_entry(void* parameter)
|
|||
struct efm32_accel_result_t result;
|
||||
|
||||
rt_kprintf(">>> waiting\n");
|
||||
rt_thread_sleep(6000);
|
||||
rt_thread_delay(6000);
|
||||
rt_kprintf(">>> start\n");
|
||||
while(1)
|
||||
{
|
||||
|
@ -483,7 +483,7 @@ void rt_demo_thread_entry(void* parameter)
|
|||
rt_kprintf("Accel x: %x\n", result.x);
|
||||
rt_kprintf("Accel y: %x\n", result.y);
|
||||
rt_kprintf("Accel z: %x\n\n", result.z);
|
||||
rt_thread_sleep(200);
|
||||
rt_thread_delay(200);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -644,7 +644,7 @@ void rt_demo_thread_entry(void* parameter)
|
|||
}
|
||||
|
||||
/* start display photos */
|
||||
rt_thread_sleep(100);
|
||||
rt_thread_delay(100);
|
||||
do
|
||||
{
|
||||
/* get a photo */
|
||||
|
@ -680,7 +680,7 @@ void rt_demo_thread_entry(void* parameter)
|
|||
}
|
||||
|
||||
rtgui_send(photo_app, &event.win.parent, sizeof(event));
|
||||
rt_thread_sleep(2000);
|
||||
rt_thread_delay(2000);
|
||||
} while (dirent != RT_NULL);
|
||||
closedir(dir);
|
||||
|
||||
|
@ -694,7 +694,7 @@ void rt_demo_thread_entry(void* parameter)
|
|||
emu_em2_enable();
|
||||
while(1)
|
||||
{
|
||||
rt_thread_sleep(10);
|
||||
rt_thread_delay(10);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -629,7 +629,7 @@ rt_err_t efm_accel_auto_zero(rt_uint8_t mode, rt_tick_t period)
|
|||
accel_debug("Accel: Offset %+d %+d %+d\n", *(rt_int16_t *)&cmd[1], \
|
||||
*(rt_int16_t *)&cmd[3], *(rt_int16_t *)&cmd[5]);
|
||||
#endif
|
||||
rt_thread_sleep(1);
|
||||
rt_thread_delay(1);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -695,7 +695,7 @@ rt_err_t efm_accel_auto_zero(rt_uint8_t mode, rt_tick_t period)
|
|||
{
|
||||
max.z = sum.z;
|
||||
}
|
||||
rt_thread_sleep(1);
|
||||
rt_thread_delay(1);
|
||||
} while (accelInTime);
|
||||
|
||||
accel_debug("Accel: Min %+d %+d %+d, max %+d %+d %+d\n",
|
||||
|
|
|
@ -437,7 +437,7 @@ static rt_ssize_t rt_leuart_write (
|
|||
// {
|
||||
// while(leuart->state & LEUART_STATE_TX_BUSY)
|
||||
// {
|
||||
// rt_thread_sleep(LEUART_WAIT_TIME_TX);
|
||||
// rt_thread_delay(LEUART_WAIT_TIME_TX);
|
||||
// }
|
||||
// }
|
||||
// TODO: This function blocks the process
|
||||
|
|
|
@ -633,7 +633,7 @@ static rt_ssize_t rt_usart_write (
|
|||
// {
|
||||
// while(usart->state & USART_STATE_TX_BUSY)
|
||||
// {
|
||||
// rt_thread_sleep(USART_WAIT_TIME_TX);
|
||||
// rt_thread_delay(USART_WAIT_TIME_TX);
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
@ -699,7 +699,7 @@ static rt_ssize_t rt_usart_write (
|
|||
// {
|
||||
// while(usart->state & USART_STATE_TX_BUSY)
|
||||
// {
|
||||
// rt_thread_sleep(USART_WAIT_TIME_TX);
|
||||
// rt_thread_delay(USART_WAIT_TIME_TX);
|
||||
// }
|
||||
// }
|
||||
write_size = size;
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
void rt_init_thread_entry(void *parameter)
|
||||
{
|
||||
while(1){
|
||||
rt_thread_sleep(200);
|
||||
rt_thread_delay(200);
|
||||
rt_hw_console_output("init thread\n");
|
||||
}
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ void rt_init_thread_entry(void *parameter)
|
|||
void rt_test1_thread_entry(void *parameter)
|
||||
{
|
||||
while(1){
|
||||
rt_thread_sleep(800);
|
||||
rt_thread_delay(800);
|
||||
rt_hw_console_output("test1 thread\n");
|
||||
}
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ void rt_test1_thread_entry(void *parameter)
|
|||
void rt_test2_thread_entry(void *parameter)
|
||||
{
|
||||
while(1){
|
||||
rt_thread_sleep(300);
|
||||
rt_thread_delay(300);
|
||||
rt_hw_console_output("test2 thread\n");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -353,16 +353,15 @@ The `rt_thread_yield()` function is similar to the `rt_schedule()` function, but
|
|||
In practical applications, we sometimes need to delay the current thread running for a period of time and re-run at a specified time. This is called "thread sleep". Thread sleep can use the following three function interfaces:
|
||||
|
||||
```c
|
||||
rt_err_t rt_thread_sleep(rt_tick_t tick);
|
||||
rt_err_t rt_thread_delay(rt_tick_t tick);
|
||||
rt_err_t rt_thread_mdelay(rt_int32_t ms);
|
||||
```
|
||||
|
||||
These three function interfaces have the same effect. Calling them can cause the current thread to suspend for a specified period of time. After, the thread will wake up and enter the ready state again. This function accepts a parameter that specifies the sleep time of the thread. The parameters and return values of the thread sleep interface rt_thread_sleep/delay/mdelay() are as follows:
|
||||
These three function interfaces have the same effect. Calling them can cause the current thread to suspend for a specified period of time. After, the thread will wake up and enter the ready state again. This function accepts a parameter that specifies the sleep time of the thread. The parameters and return values of the thread sleep interface rt_thread_delay/mdelay() are as follows:
|
||||
|
||||
|**Parameters**|Description |
|
||||
| -------- | ------------------------------------------------------------ |
|
||||
| tick/ms | Thread sleep time:<br>The input parameter tick of rt_thread_sleep/rt_thread_delay is in units of 1 OS Tick; <br>The input parameter ms of rt_thread_mdelay is in units of 1ms; |
|
||||
| tick/ms | Thread sleep time:<br>The input parameter tick of rt_thread_delay is in units of 1 OS Tick; <br>The input parameter ms of rt_thread_mdelay is in units of 1ms; |
|
||||
|**Return**| —— |
|
||||
| RT_EOK | Successful operation. |
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
#include <pthread.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#define usleep rt_thread_sleep
|
||||
#define usleep rt_thread_delay
|
||||
|
||||
static void *test_thread(void *v_param) {
|
||||
return NULL;
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
#include <sys/time.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#define usleep rt_thread_sleep
|
||||
#define usleep rt_thread_delay
|
||||
|
||||
/* Our event variable using a condition variable contruct. */
|
||||
typedef struct {
|
||||
|
|
|
@ -57,7 +57,7 @@ FINSH_FUNCTION_EXPORT(libc_lseek, lseek test for libc);
|
|||
|
||||
void sleep(int tick)
|
||||
{
|
||||
rt_thread_sleep(tick);
|
||||
rt_thread_delay(tick);
|
||||
}
|
||||
|
||||
int libc_fseek(void)
|
||||
|
|
Loading…
Reference in New Issue