mirror of
https://github.com/ossrs/srs.git
synced 2025-02-13 03:41:55 +00:00
refs #182: rename to sync test.
This commit is contained in:
parent
69fdec411f
commit
511c814ffb
1 changed files with 13 additions and 0 deletions
|
@ -8,6 +8,7 @@
|
|||
st_mutex_t sync_start = NULL;
|
||||
st_cond_t sync_cond = NULL;
|
||||
st_mutex_t sync_mutex = NULL;
|
||||
st_cond_t sync_end = NULL;
|
||||
|
||||
void* sync_master(void* arg)
|
||||
{
|
||||
|
@ -50,11 +51,15 @@ void* sync_slave(void* arg)
|
|||
st_cond_wait(sync_cond);
|
||||
srs_trace("4. st is ok");
|
||||
|
||||
st_cond_signal(sync_end);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int sync_test()
|
||||
{
|
||||
srs_trace("sync test: start");
|
||||
|
||||
if ((sync_start = st_mutex_new()) == NULL) {
|
||||
srs_trace("st_mutex_new sync_start failed");
|
||||
return -1;
|
||||
|
@ -65,6 +70,11 @@ int sync_test()
|
|||
srs_trace("st_cond_new cond failed");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if ((sync_end = st_cond_new()) == NULL) {
|
||||
srs_trace("st_cond_new end failed");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if ((sync_mutex = st_mutex_new()) == NULL) {
|
||||
srs_trace("st_mutex_new mutex failed");
|
||||
|
@ -84,6 +94,9 @@ int sync_test()
|
|||
// run all threads.
|
||||
st_mutex_unlock(sync_start);
|
||||
|
||||
st_cond_wait(sync_end);
|
||||
srs_trace("sync test: end");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue