con 4
This commit is contained in:
parent
1e5e8dc896
commit
efb10ef91e
|
@ -5,7 +5,7 @@
|
|||
|
||||
#define MAX_NAME 16
|
||||
|
||||
static int _MSGQID;
|
||||
int _MSGQID;
|
||||
|
||||
#define MSG 1
|
||||
#define MOVE 2
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
#define CLIENT1 1
|
||||
#define SERVER 2
|
||||
|
||||
int _SEMID;
|
||||
|
||||
void setupServerSem();
|
||||
|
||||
int getSemid(key_t key, int size);
|
||||
|
|
|
@ -32,7 +32,6 @@ typedef enum {
|
|||
PLAYER2
|
||||
} tile_t;
|
||||
|
||||
static int _SEMID;
|
||||
static int _SHMID;
|
||||
|
||||
static tile_t *_BOARD;
|
||||
|
|
|
@ -49,6 +49,8 @@ int main(int argc, char *argv[]){
|
|||
|
||||
// aperurta semaforo per connessione dei due client
|
||||
printf(PSERVER "Waiting for players...\n");
|
||||
|
||||
printf("%d\n", _SEMID);
|
||||
semOp(_SEMID, 0, 1);
|
||||
semOp(_SEMID, 1, 1);
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#include <sys/sem.h>
|
||||
#include <sys/stat.h>
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <custom_sem.h>
|
||||
#include <structures.h>
|
||||
|
@ -16,6 +17,8 @@ void setupServerSem() {
|
|||
}
|
||||
|
||||
resetServerSem(_SEMID);
|
||||
|
||||
printf("%d\n", _SEMID);
|
||||
}
|
||||
|
||||
void semOp(int semid, short sem_num, short sem_op) {
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include <structures.h>
|
||||
#include <errExit.h>
|
||||
#include <custom_msgq.h>
|
||||
#include <custom_sem.h>
|
||||
|
||||
static int sigint_count = 2;
|
||||
|
||||
|
|
Loading…
Reference in New Issue