mirror of
https://github.com/geohot/qira
synced 2025-03-13 10:33:30 +03:00
21 lines
357 B
C
21 lines
357 B
C
#include <stdio.h>
|
|
#include <pthread.h>
|
|
|
|
void start1() {
|
|
int i = 100;
|
|
while (1) { printf("t1 %d\n", i++); sleep(1); }
|
|
}
|
|
|
|
void start2() {
|
|
int i = 200;
|
|
while (1) { printf("t2 %d\n", i++); sleep(1); }
|
|
}
|
|
|
|
int main() {
|
|
pthread_t t1, t2;
|
|
pthread_create(&t1, NULL, start1, NULL);
|
|
pthread_create(&t2, NULL, start2, NULL);
|
|
pthread_join(t1, NULL);
|
|
}
|
|
|