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.
srs/trunk/research/st/hello-thread.cpp

22 lines
393 B
C++

/*
g++ hello-thread.cpp ../../objs/st/libst.a -g -O0 -o hello-thread && ./hello-thread
*/
#include <stdio.h>
#include "../../objs/st/st.h"
void* foo(void *args) {
for (int i = 0; ; i++) {
st_sleep(1);
printf("#%d: main: working\n", i);
}
return NULL;
}
int main() {
st_init();
st_thread_create(foo, NULL, 0, 0);
st_thread_exit(NULL);
return 0;
}