winlin

update st research.

  1 +#include <unistd.h>
  2 +#include <stdio.h>
  3 +
1 #include "public.h" 4 #include "public.h"
2 5
  6 +#define srs_trace(msg, ...) printf(msg, ##__VA_ARGS__);printf("\n")
  7 +
  8 +void* pfn(void* arg)
  9 +{
  10 + st_sleep(1);
  11 + srs_trace("st thread is ok");
  12 + return NULL;
  13 +}
  14 +
3 int main(int argc, char** argv) 15 int main(int argc, char** argv)
4 { 16 {
  17 + if (st_set_eventsys(ST_EVENTSYS_ALT) < 0) {
  18 + srs_trace("st_set_eventsys failed");
  19 + return -1;
  20 + }
  21 +
  22 + if (st_init() < 0) {
  23 + srs_trace("st_init failed");
  24 + return -1;
  25 + }
  26 +
  27 + if (!st_thread_create(pfn, NULL, 0, 0)) {
  28 + srs_trace("st_thread_create failed");
  29 + return -1;
  30 + }
  31 +
  32 + srs_trace("st is ok");
  33 +
  34 + st_thread_exit(NULL);
  35 +
5 return 0; 36 return 0;
6 } 37 }
7 38