-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathglobal.h
More file actions
33 lines (30 loc) · 797 Bytes
/
global.h
File metadata and controls
33 lines (30 loc) · 797 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#ifndef _GLOBAL_H
#define _GLOBAL_H
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<SDL/SDL_net.h>
#include<semaphore.h>
#include<unistd.h>
#include<pthread.h>
IPaddress host_ipaddress; // will hold server ip address
void * handle(void* data);
// structure which contain information for a particular thread
struct socket
{
IPaddress *client_ipaddress;
TCPsocket server_socket;
Uint16 port;
};
struct threadID
{
int reference; // to be used as a reference in thread pool
pthread_t ID;
int status; // 1 if thread is in use or otherwise zero.
sem_t binary_sem; // used as binary semphore
struct socket client;
struct threadID *next;
};
struct threadID * thread_header; // header use for pointing to standby/inactive threads
pthread_mutex_t mutex_variable;
#endif