mirror of
https://github.com/apache/nuttx-apps.git
synced 2026-10-06 05:43:01 +00:00
OS test: improve the sporadic scheduler test by waiting for a bit in the 'nuisance' thread
This commit is contained in:
parent
c27364570f
commit
ae2e61c764
1 changed files with 22 additions and 0 deletions
|
|
@ -73,13 +73,35 @@ static time_t g_start_time;
|
|||
* Private Functions
|
||||
***********************************************************************/
|
||||
|
||||
void my_mdelay(unsigned int milliseconds)
|
||||
{
|
||||
volatile unsigned int i;
|
||||
volatile unsigned int j;
|
||||
|
||||
for (i = 0; i < milliseconds; i++)
|
||||
{
|
||||
for (j = 0; j < CONFIG_BOARD_LOOPSPERMSEC; j++)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
static void *nuisance_func(void *parameter)
|
||||
{
|
||||
/* Synchronized start */
|
||||
|
||||
while (sem_wait(&g_sporadic_sem) < 0);
|
||||
|
||||
/* Sleep until we are cancelled */
|
||||
|
||||
for (;;)
|
||||
{
|
||||
/* Sleep gracefully for awhile */
|
||||
|
||||
usleep(500*1000);
|
||||
|
||||
/* Then hog some CPU time */
|
||||
|
||||
my_mdelay(100);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue