/*Another program in which loop is executing in one thread & printing loop in one another thread*//*A program to show mutex or binary semaphore imlementaion*/
//Actually MUTEX is a macro whose code is same as instruction of binary semaphore ..
//so it will work exactly like binary semaphore
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<pthread.h>
#include<semaphore.h>
void* thread_fun1(void*);
void* thread_fun2(void*);
void* thread_fun3(void*);
void* thread_fun4(void*);
char buff[24],set[20];//a global variable is taken
int a[100],i;//buff of 100
pthread_mutex_t lock;//variable is declared
int main()
{
int lv;
void* retval;
char *message="THIS IS LINUX";
pthread_t tid1,tid2,tid3,tid4;
if(!pthread_mutex_init(&lock,NULL))//INSTED OF null pointer there may be PTHREAD_MUTEX_INTIALISATION of type pthread_mutexattr_t pointer