mirror of
https://github.com/ossrs/srs.git
synced 2025-02-15 04:42:04 +00:00
ST: Add example for backtrace.
This commit is contained in:
parent
00f9fb88d9
commit
1601381ae8
1 changed files with 29 additions and 0 deletions
29
trunk/research/st/backtrace.cpp
Normal file
29
trunk/research/st/backtrace.cpp
Normal file
|
@ -0,0 +1,29 @@
|
|||
/*
|
||||
g++ backtrace.cpp ../../objs/st/libst.a -g -O0 -o backtrace && ./backtrace
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include "../../objs/st/st.h"
|
||||
|
||||
void* pfn(void* arg) {
|
||||
for (;;) {
|
||||
printf("Hello, coroutine\n");
|
||||
st_sleep(1);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int bar(int argc) {
|
||||
st_thread_create(pfn, NULL, 0, 0);
|
||||
return argc + 1;
|
||||
}
|
||||
|
||||
int foo(int argc) {
|
||||
return bar(argc);
|
||||
}
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
st_init();
|
||||
foo(argc);
|
||||
st_thread_exit(NULL);
|
||||
return 0;
|
||||
}
|
Loading…
Reference in a new issue