Today's Question:  What does your personal desk look like?        GIVE A SHOUT

 ALL


  Exit main thread and keep other threads running in C

In C programming, if using return in main function, the whole process will terminate. To only let main thread gone, and keep other threads live, you can use thrd_exit in main function. Check following code:#include #include #include intprint_thread(void *s){ thrd_detach(thrd_current()); for (size_t i = 0; i < 5; i++) { sleep(1); printf("i=%zu\n", i); } thrd_exit(0);}intmain(void){ thrd_t tid; if (thrd_success != thrd_create(&tid, print_thread, NULL)) { fprintf(stderr, "Create thread err...

1,377 0       MAIN THREAD MULITHREAD C LANGUAGE


  A Toast to C

At Cloudmetrx, we use a lot of C. So given the recent passing of UNIX legend Dennis Ritchie, the creator of the C language, we think a toast to C is only fitting.Our extensive reliance on C is especially unusual considering the other languages in our stack – Clojure, Node.js, and other hipster platforms. We aren't predisposed to using older, "venerated" technologies simply because they're older and venerated. But when it comes to high-performant computation, there's just nothing like C. Some will claim Java, but those people are incorrect. There's nothing like C.In my opinion, the reaso...

4,191 0       C POPULARITY DENNIS RITCHIE UNIX TOAST C LANGUAGE