Entries from 2013-02-19 to 1 day

pthread 2 Mutex

C++

i#include <stdio.h> #include <unistd.h> // usleep() #include <pthread.h> pthread_mutex_t mutex; // Mutex // スレッド1 void* thread1( void* args ) { // 他のスレッドが mutex を返却するを待つ // mutex が返却されたら mutex を取得してブロック pthread_mutex_lock( &mutex ); /</pthread.h></unistd.h></stdio.h>…

pthread

Process is a running program and in multi task OS, different process is allocated to each memory space. Basically, memory space can not be accessed from different process.Thread is an executable unit which is executed independently in one …