X-Git-Url: http://git.harvie.cz/?a=blobdiff_plain;f=c%2Fpthread_extra%2Ftest.c;h=891cd504c2632171618254e0f32db5e85bc813d6;hb=5251b63c80878b87d8cb808efd3978bd819c4f8b;hp=a41ca54a0023cdcfc714f18540d5fc9fe30ec4da;hpb=3aac261937c3a94461f4dd8fa64c17d5e158c692;p=mirrors%2FPrograms.git diff --git a/c/pthread_extra/test.c b/c/pthread_extra/test.c index a41ca54..891cd50 100644 --- a/c/pthread_extra/test.c +++ b/c/pthread_extra/test.c @@ -17,7 +17,7 @@ int main_mumu() { //Set timeout struct timespec tm; clock_gettime(CLOCK_REALTIME, &tm); - tm.tv_sec += 5; + tm.tv_sec += 2; //Lock one of the locks for testing pthread_mutex_lock(lck[2]); @@ -29,24 +29,27 @@ int main_mumu() { printf("FAILED!\n"); } + return 0; } pthread_mq_t myq; -void *thread_recv(void *args) { +void *thread_recv() { + //(void *)args; + char str[128]; while(1) { pthread_mq_receive_generic(&myq, &str, false, PTHREAD_XTIME_FOREVER); - printf("RECVD: %.6s\t\t(waiting %d)\n", str, pthread_mq_waiting(&myq)); - //sleep(1); + printf("RECVD: %.6s\t\t(waiting %d)\n", str, (int)pthread_mq_waiting(&myq)); + sleep(1); } } int main() { - main_mumu(); + //main_mumu(); - char tmp[128]; + //char tmp[128]; pthread_mq_init(&myq, 6, 5);