-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmthreads.h
40 lines (34 loc) · 879 Bytes
/
mthreads.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
#ifndef _EMERALD_MTHREADS_H
#define _EMERALD_MTHREADS_H
#pragma warning(disable: 4068)
#pragma pointer_size save
#pragma pointer_size long
#include <sys/types.h>
#ifndef WIN32
#include <sys/time.h>
#include <stdarg.h>
#include <sys/socket.h>
#include <netinet/in.h>
#endif
#pragma pointer_size restore
#ifdef WIN32
#ifdef MSVC40
#include <winsock.h>
#else
#include <winsock2.h>
#endif
#endif
typedef struct NodeAddr {
unsigned int ipaddress;
unsigned short port;
unsigned short incarnation;
} NodeAddr;
extern void MTInit(void);
void MTStart(void);
void MTRegisterExitRoutine(void (*)(void));
int MTNetStart(unsigned int, unsigned short, unsigned short);
int MTSend(NodeAddr receiver, void *sbuf, int slen);
int MTProd(NodeAddr *receiver);
typedef void (*NotifyFunction)(NodeAddr id, int isup);
void MTRegisterNotify(NotifyFunction);
#endif /* _EMERALD_MTHREADS_H */