Search
 
SCRIPT & CODE EXAMPLE
 

CPP

pthread c++ example with output

// thread01.c
#include <pthread.h>
#include <stdio.h>
#include <stdlib.h>

#define N 5

void *worker_thread(void *arg)
{
        printf("This is worker_thread #%ld
", (long)arg);
        pthread_exit(NULL);
}

int main()
{
        pthread_t my_thread[N];

        long id;
        for(id = 1; id <= N; id++) {
                int ret =  pthread_create(&my;_thread[id], NULL, &worker;_thread, (void*)id);
                if(ret != 0) {
                        printf("Error: pthread_create() failed
");
                        exit(EXIT_FAILURE);
                }
        }

        pthread_exit(NULL);
}
Comment

PREVIOUS NEXT
Code Example
Cpp :: c++ download 
Cpp :: C++ CHEAT SHEAT 
Cpp :: C+++++++++++++++++++++++++++ JAVA 
Cpp :: flipperRSocketResponder.cpp command failed react native 
Cpp :: gtest assert not equal 
Cpp :: how to get characters through their ascii value in c++ 
Cpp :: in built function to find MSB in cpp 
Cpp :: c++ *agrs 
Cpp :: c++ friend keyword 
Cpp :: use ster when declaring variables cpp 
Cpp :: full pyramid in c++ 
Cpp :: Corong_ExerciseNo3 
Cpp :: nmake.exe is not found in the windows 
Cpp :: Access Elements in C++ Array 
Cpp :: convert c++ to c online 
Cpp :: what c++ library is arccos in 
Cpp :: https://www.cplusplus.com/doc/tutorial/pointers/ 
Cpp :: I/O Redirection in C++ 
Cpp :: Password codechef solution in c++ 
Cpp :: cpp stacks 
Cpp :: sento freddo a un dente 
Cpp :: convert char to string c++ 
Cpp :: set the jth bit from 1 to 0 
Cpp :: max in c++ with three elements 
Cpp :: hpp files 
Cpp :: c++ first index 0 or 1 
Cpp :: c++ start thread later 
Cpp :: what are manipulators in c++ 
Cpp :: interactive problem 
Cpp :: https://www.google 
ADD CONTENT
Topic
Content
Source link
Name
6+3 =