Fixed compiling errors.
This commit is contained in:
parent
0c2059d598
commit
6e3005d25a
2 changed files with 14 additions and 10 deletions
9
makefile
9
makefile
|
@ -3,13 +3,10 @@
|
|||
all: dataserver simpleclient
|
||||
|
||||
reqchannel.o: reqchannel.h reqchannel.cpp
|
||||
#g++-4.7 -c -g reqchannel.cpp
|
||||
g++ -std=c++11 -c -g reqchannel.cpp
|
||||
g++ -std=c++11 -c -g reqchannel.cpp
|
||||
|
||||
dataserver: dataserver.cpp reqchannel.o
|
||||
#g++-4.7 -g -o
|
||||
g++ -std=c++11 -g -odataserver dataserver.cpp reqchannel.o -lpthread
|
||||
g++ -std=c++11 -g -o dataserver dataserver.cpp reqchannel.o -lpthread
|
||||
|
||||
simpleclient: simpleclient.cpp reqchannel.o
|
||||
#g++-4.7 -g -o simpleclient simpleclient.cpp reqchannel.o
|
||||
g++ -std=c++11 -g -o simpleclient simpleclient.cpp reqchannel.o
|
||||
g++ -std=c++11 -g -o simpleclient simpleclient.cpp reqchannel.o
|
||||
|
|
15
semaphore.h
15
semaphore.h
|
@ -22,7 +22,7 @@
|
|||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
#include <pthread.h>
|
||||
#include <mutex>
|
||||
//#include <mutex>
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
/* DATA STRUCTURES */
|
||||
|
@ -60,9 +60,16 @@ public:
|
|||
/* -- SEMAPHORE OPERATIONS */
|
||||
|
||||
int P(){
|
||||
Lock();
|
||||
|
||||
|
||||
//This is to lock the Semaphore.
|
||||
pthread_mutex_lock( &m );
|
||||
|
||||
//Wait until condition, basically wait until signaled.
|
||||
pthread_cond_wait( &c, &m );
|
||||
|
||||
//Some code here.
|
||||
|
||||
//Unlock the Semaphore.
|
||||
pthread_mutex_unlock( &m );
|
||||
}
|
||||
//;
|
||||
int V();
|
||||
|
|
Reference in a new issue