forked from data61/MP-SPDZ
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSender.h
47 lines (35 loc) · 730 Bytes
/
Sender.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
/*
* Sender.h
*
*/
#ifndef NETWORKING_SENDER_H_
#define NETWORKING_SENDER_H_
#include <pthread.h>
#include "Tools/octetStream.h"
#include "Tools/WaitQueue.h"
#include "Tools/time-func.h"
template<class T>
class Sender
{
T socket;
WaitQueue<const octetStream*> in;
WaitQueue<const octetStream*> out;
pthread_t thread;
static void* run_thread(void* sender);
// prevent copying
Sender(const Sender& other);
void start();
void stop();
void run();
public:
Timer timer;
Sender(T socket);
~Sender();
T get_socket()
{
return socket;
}
void request(const octetStream& os);
void wait(const octetStream& os);
};
#endif /* NETWORKING_SENDER_H_ */