Search
 
SCRIPT & CODE EXAMPLE
 

C

thread in c

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>  //Header file for sleep(). man 3 sleep for details.
#include <pthread.h>
  
// A normal C function that is executed as a thread 
// when its name is specified in pthread_create()
void *myThreadFun(void *vargp)
{
    sleep(1);
    printf("Printing GeeksQuiz from Thread 
");
    return NULL;
}
   
int main()
{
    pthread_t thread_id;
    printf("Before Thread
");
    pthread_create(&thread_id, NULL, myThreadFun, NULL);
    pthread_join(thread_id, NULL);
    printf("After Thread
");
    exit(0);
}
Comment

threads in c

pthread_join(p_thread* id, void** return_value);
Comment

PREVIOUS NEXT
Code Example
C :: c check if character is a digit or alphabet 
C :: how to read from a file in c 
C :: Compile multiple C files 
C :: bool c++ 
C :: Find the how many bits is turned on in a numebr 
C :: Multi-line Comments in C 
C :: majuscule en c 
C :: logical operators 
C :: C Syntax of realloc() 
C :: how to input a string into a char array cpp 
C :: c read file from command line 
C :: c sjf 
C :: voide means in c 
C :: c program for calculating product of array 
C :: C++ How to use enums for flags? 
C :: get string from ptrace registery 
C :: how to find folders from a c program 
C :: C access global variable same name 
C :: 1 f = c 
C :: java Node<E 
C :: how to alias an awk command 
C :: when to add & in snacf c 
C :: adding three numbers in c 
C :: what to do after autoencoder training 
C :: ringing a bell using c 
C :: user define 
C :: dynamic stack in c 
C :: c check if file was created 
C :: recursion c prime number 
Dart :: dart random number 
ADD CONTENT
Topic
Content
Source link
Name
3+5 =