]>
Commit | Line | Data |
---|---|---|
db352b46 | 1 | // Main authors: Mihai Niculescu 2014 |
2 | ||
3 | /************************************************************************** | |
4 | * Copyright(c) 1998-2008, ALICE Experiment at CERN, all rights reserved. * | |
5 | * See http://aliceinfo.cern.ch/Offline/AliRoot/License.html for * | |
6 | * full copyright notice. * | |
7 | **************************************************************************/ | |
8 | ||
9 | #ifndef AliThreadedSocket_H | |
10 | #define AliThreadedSocket_H | |
11 | ||
12 | #include <TQObject.h> | |
13 | ||
14 | class TThread; | |
15 | class AliNetMessage; | |
16 | ||
17 | namespace zmq { | |
18 | class context_t; | |
19 | } | |
20 | ||
21 | class AliThreadedSocket : public TQObject | |
22 | { | |
23 | public: | |
24 | enum EOpenMode{READ, WRITE}; | |
25 | ||
26 | AliThreadedSocket(zmq::context_t *context, EOpenMode mode); | |
27 | virtual ~AliThreadedSocket(); | |
28 | ||
29 | Bool_t Start(); | |
30 | Bool_t Stop(); | |
31 | Bool_t Kill(); | |
32 | ||
33 | zmq::context_t* GetContext() const; | |
34 | TThread* GetThread() const; | |
35 | ||
36 | void Started(); // *SIGNAL* | |
37 | void Stopped(); // *SIGNAL* | |
38 | ||
39 | void Continue(); | |
40 | ||
41 | protected: | |
42 | AliThreadedSocket(const AliThreadedSocket&); // Not implemented | |
43 | AliThreadedSocket& operator=(const AliThreadedSocket&); // Not implemented | |
44 | ||
45 | // reimplement these in a derived class | |
46 | static void* RunThrdRead(void* arg); | |
47 | static void* RunThrdWrite(void* arg); | |
48 | ||
49 | zmq::context_t* fContext; | |
50 | TThread* fThread; | |
51 | EOpenMode fOpenMode; | |
52 | ||
53 | ||
54 | ClassDef(AliThreadedSocket, 0); | |
55 | ||
56 | }; | |
57 | #endif |