1 // Main authors: Mihai Niculescu 2014
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 **************************************************************************/
9 #ifndef AliThreadedSocket_H
10 #define AliThreadedSocket_H
21 class AliThreadedSocket : public TQObject
24 enum EOpenMode{kREAD, kWRITE};
26 AliThreadedSocket(zmq::context_t *context, EOpenMode mode);
27 virtual ~AliThreadedSocket();
34 zmq::context_t* GetContext() const;
35 TThread* GetThread() const;
36 EOpenMode GetMode() const { return fOpenMode; }
38 void Started(); // *SIGNAL*
39 void Stopped(); // *SIGNAL*
44 AliThreadedSocket(const AliThreadedSocket&); // Not implemented
45 AliThreadedSocket& operator=(const AliThreadedSocket&); // Not implemented
47 // Reimplement these in a derived Class
48 virtual void RunThrdRead(); // function to run in a thread when in Read mode
49 virtual void RunThrdWrite(); // function to run in a thread when in Write mode
52 zmq::context_t* fContext;
56 static void* Dispatch(void* arg)
58 AliThreadedSocket* th = static_cast<AliThreadedSocket*>(arg);
60 if(th->GetMode()==kREAD)
68 ClassDef(AliThreadedSocket, 0);