mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
research st, expand MD_INIT_CONTEXT macro, the thread start.
This commit is contained in:
parent
8da8c49f39
commit
2c01f7e943
5 changed files with 73 additions and 44 deletions
|
@ -46,6 +46,21 @@ int huge_stack_test()
|
|||
return 0;
|
||||
}
|
||||
|
||||
int sleep_test()
|
||||
{
|
||||
srs_trace("===================================================");
|
||||
srs_trace("sleep test: start");
|
||||
|
||||
srs_trace("1. sleep...");
|
||||
|
||||
st_usleep(sleep_ms * 1000);
|
||||
srs_trace("2. sleep ok");
|
||||
|
||||
srs_trace("sleep test: end");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void* thread_func(void* arg)
|
||||
{
|
||||
srs_trace("1. thread run");
|
||||
|
@ -68,8 +83,10 @@ int thread_test()
|
|||
st_thread_join(trd, NULL);
|
||||
srs_trace("3. thread joined");
|
||||
|
||||
st_thread_exit(NULL);
|
||||
srs_trace("4. all thread completed");
|
||||
|
||||
srs_trace("thread test: end");
|
||||
exit(0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -342,6 +359,11 @@ int main(int argc, char** argv)
|
|||
return -1;
|
||||
}
|
||||
|
||||
if (sleep_test() < 0) {
|
||||
srs_trace("sleep_test failed");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (thread_test() < 0) {
|
||||
srs_trace("thread_test failed");
|
||||
return -1;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue