Header file for server.c.
More...
Go to the source code of this file.
|
typedef struct Client | Client |
|
typedef struct Room | Room |
|
Header file for server.c.
◆ SYNC_CLIENT_READ
#define SYNC_CLIENT_READ |
( |
|
op | ) |
|
Value:
op; \
releaseRead(clientsLock);
Macro to synchronize clients read operation.
◆ SYNC_CLIENT_WRITE
#define SYNC_CLIENT_WRITE |
( |
|
op | ) |
|
Value:
op; \
releaseWrite(clientsLock);
Macro to synchronize clients write operation.
◆ SYNC_ROOM_READ [1/2]
#define SYNC_ROOM_READ |
( |
|
room, |
|
|
|
op |
|
) |
| |
Value:
op; \
releaseRead(room->lock);
Macro to synchronize read operation on a single room.
◆ SYNC_ROOM_READ [2/2]
#define SYNC_ROOM_READ |
( |
|
room, |
|
|
|
op |
|
) |
| |
Value:
op; \
releaseRead(room->lock);
Macro to synchronize read operation on a single room.
◆ SYNC_ROOMS_READ
#define SYNC_ROOMS_READ |
( |
|
op | ) |
|
Value:
op; \
releaseRead(roomsLock);
Macro to synchronize rooms read operation.
◆ SYNC_ROOMS_WRITE
#define SYNC_ROOMS_WRITE |
( |
|
op | ) |
|
Value:
op; \
releaseWrite(roomsLock);
Macro to synchronize rooms write operation.
◆ handleClientsPackets()
void handleClientsPackets |
( |
Client * |
client | ) |
|
Relay messages sent by given client to all known clients.
Waits for an incoming message, and broadcast it (in a correctly formed relayed message) to all known clients.
- Parameters
-
client | The client to wait messages from |
◆ handleServerClose()
void handleServerClose |
( |
int |
signal | ) |
|
Catch interrupt signal.
- Parameters
-
◆ rooms
An array containing all pointers to existing rooms.
It can be written by any client thread at any time if a client creates or deletes a room. It can be read by any client thread at any time if a client joins a room.
We MUST acquire roomsLock to access this field.
void acquireRead(ReadWriteLock lock)
Acquires read lock on the given read/write lock.
Definition: synchronization.c:16
void acquireWrite(ReadWriteLock lock)
Acquires write lock on the given read/write lock.
Definition: synchronization.c:38