multithreading - C++ Micro Second Timer with parallel thread in Linux/Ubuntu -


i created timer , called every 0.1 millisecond. it's working good. problem faced thread calling timer. timer calling infinite time.

i process 2 parallel thread or process inside timer(with 0.1 millisec). possible? i'm using ubuntu 12.04 lts. sample code follows

int main(void) {     if (start_timer(0.1, &timer_handler)) //0.1 millisec timer caleed     {         printf("\n timer error\n");         return(1);     }     while (1)     {         if (var > 10)       break;     }     stop_timer();     return 0; }  void timer_handler(void) {     int ret = 0;     pthread_create(&thread, null, test_thread, null);     pthread_join(thread, (void **)&ret);     printf("test_thread : %d\n", ret); }  void *test_thread(void *arg) {     pthread_exit((void*)cnt++); } 


Comments

Popular posts from this blog

java - Run spring boot application error: Cannot instantiate interface org.springframework.context.ApplicationListener -

reactjs - React router and this.props.children - how to pass state to this.props.children -

Excel VBA "Microsoft Windows Common Controls 6.0 (SP6)" Location Changes -