-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtype.h
81 lines (59 loc) · 1.66 KB
/
type.h
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#ifndef __TYPE_H__
#define __TYPE_H__
#include <errno.h>
#include <netdb.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <sys/ioctl.h>
#include <net/if.h>
#include <pthread.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <sys/syscall.h>
#include <sys/mman.h>
#include <stdio.h>
#include <iostream>
#include <string.h>
#include <sys/time.h>
#include <unistd.h>
//#include "libwebserve.h"
#define UINT16 unsigned short
#define UINT unsigned int
#define ULONG unsigned long
#define TRUE 1
#define FALSE 0
#define BOOL unsigned char
#define VOID void
#define INT int
#define BYTE unsigned char
#define PVOID void*
#define PBYTE BYTE*
#define DWORD unsigned long
#define INT64 long long
#define UINT32 unsigned int
#define FALSE 0
#define TRUE 1
#define FILE_LEN 256
#define SOCKADDR_IN struct sockaddr_in
#define SOCKADDR struct sockaddr
#define WORD unsigned int
typedef void * (ThreadFunc)(void *);
static inline int CreateGerneralThreadWithArg(ThreadFunc threadFunc, void *arg)
{
pthread_attr_t attr;
struct sched_param param;
pthread_t thread;
int ret;
sched_getparam(0, ¶m);
param.sched_priority = sched_get_priority_max(SCHED_FIFO);
pthread_attr_init(&attr);
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
pthread_attr_setschedpolicy(&attr, SCHED_FIFO);
pthread_attr_setschedparam(&attr, ¶m);
ret = pthread_create(&thread, &attr, threadFunc, arg);
pthread_attr_destroy(&attr);
return ret;
}
#define CreateGerneralThread(threadFunc) CreateGerneralThreadWithArg(threadFunc, NULL)
#endif