mirror of https://github.com/ossrs/srs.git
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
437 B
C++
27 lines
437 B
C++
6 months ago
|
/*
|
||
|
g++ st-cond.cpp ../../objs/st/libst.a -g -O0 -o st-cond && ./st-cond
|
||
|
*/
|
||
|
#include <stdio.h>
|
||
|
#include "../../objs/st/st.h"
|
||
|
|
||
|
st_cond_t lock;
|
||
|
|
||
|
void* foo(void*) {
|
||
|
st_cond_wait(lock);
|
||
|
printf("Hello World, ST!\n");
|
||
|
return NULL;
|
||
|
}
|
||
|
|
||
|
int main() {
|
||
|
st_init();
|
||
|
lock = st_cond_new();
|
||
|
|
||
|
st_thread_create(foo, NULL, 0, 0);
|
||
|
st_sleep(1);
|
||
|
st_cond_signal(lock);
|
||
|
st_sleep(1);
|
||
|
|
||
|
st_cond_destroy(lock);
|
||
|
return 0;
|
||
|
}
|