~ubuntu-branches/ubuntu/wily/flrig/wily

« back to all changes in this revision

Viewing changes to .pc/0001-License-Declaration.patch/src/xmlrpcpp/XmlRpcThread.h

  • Committer: Package Import Robot
  • Author(s): Kamal Mostafa
  • Date: 2014-06-07 11:28:52 UTC
  • Revision ID: package-import@ubuntu.com-20140607112852-pj9xhtlvwpgqjy5x
Tags: 1.3.15-1
* Initial release (Closes: #750861)
  flrig version 1.3.15 plus the following upstream commits:
  - 0001-License-Declaration.patch
  - 0002-FL_APPS-folder.patch
  - 0003-rig-home-dir.patch
  - 0004-RTS-DTR-restore.patch

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef _XMLRPCTHREAD_H_
 
2
#define _XMLRPCTHREAD_H_
 
3
//
 
4
// XmlRpc++ Copyright (c) 2002-2003 by Chris Morley
 
5
//
 
6
#if defined(_MSC_VER)
 
7
# pragma warning(disable:4786)    // identifier was truncated in debug info
 
8
#endif
 
9
 
 
10
namespace XmlRpc {
 
11
 
 
12
  //! An abstract class providing an interface for objects that can run in a separate thread.
 
13
  class XmlRpcRunnable {
 
14
  public:
 
15
      //! Code to be executed.
 
16
      virtual void run() = 0;
 
17
  };  // class XmlRpcRunnable
 
18
 
 
19
 
 
20
  //! A simple platform-independent thread API implemented for posix and windows.
 
21
  class XmlRpcThread {
 
22
  public:
 
23
    //! Construct a thread object. Not usable until setRunnable() has been called.
 
24
    XmlRpcThread() : _runner(0), _pThread(0) {}
 
25
 
 
26
    //! Construct a thread object.
 
27
    XmlRpcThread(XmlRpcRunnable* runnable) : _runner(runnable), _pThread(0) {}
 
28
 
 
29
    //! Destructor. Does not perform a join() (ie, the thread may continue to run).
 
30
    ~XmlRpcThread();
 
31
 
 
32
    //! Execute the run method of the runnable object in a separate thread.
 
33
    //! Returns immediately in the calling thread.
 
34
    void start();
 
35
 
 
36
    //! Waits until the thread exits.
 
37
    void join();
 
38
 
 
39
    //! Access the runnable
 
40
    XmlRpcRunnable* getRunnable() const { return _runner; }
 
41
 
 
42
    //! Set the runnable
 
43
    void setRunnable(XmlRpcRunnable* r) { _runner = r; }
 
44
 
 
45
  private:
 
46
 
 
47
    //! Start the runnable going in a thread
 
48
    static unsigned int __stdcall runInThread(void* pThread);
 
49
 
 
50
    //! Code to be executed
 
51
    XmlRpcRunnable* _runner;
 
52
 
 
53
    //! Native thread object
 
54
    void* _pThread;
 
55
 
 
56
  };  // class XmlRpcThread
 
57
 
 
58
}  // namespace XmlRpc
 
59
 
 
60
#endif  //  _XMLRPCTHREAD_H_