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

« back to all changes in this revision

Viewing changes to .pc/0001-License-Declaration.patch/src/xmlrpcpp/XmlRpcThreadedServer.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
 
 
2
#ifndef _XMLRPCTHREADEDSERVER_H_
 
3
#define _XMLRPCTHREADEDSERVER_H_
 
4
//
 
5
// XmlRpc++ Copyright (c) 2002-2003 by Chris Morley
 
6
//
 
7
#if defined(_MSC_VER)
 
8
# pragma warning(disable:4786)    // identifier was truncated in debug info
 
9
#endif
 
10
 
 
11
#ifndef MAKEDEPEND
 
12
# include <map>
 
13
# include <vector>
 
14
#endif
 
15
 
 
16
 
 
17
#include "XmlRpcMutex.h"
 
18
#include "XmlRpcServer.h"
 
19
#include "XmlRpcThread.h"
 
20
 
 
21
 
 
22
namespace XmlRpc {
 
23
 
 
24
  //! A class to handle multiple simultaneous XML RPC requests
 
25
  class XmlRpcThreadedServer : public XmlRpcServer {
 
26
  public:
 
27
 
 
28
    //! Create a server object with a specified number of worker threads.
 
29
    XmlRpcThreadedServer(int nWorkers = 6) : _workers(nWorkers) {}
 
30
 
 
31
 
 
32
    //! Execute a request
 
33
 
 
34
  protected:
 
35
 
 
36
    //! Each client request is assigned to one worker to handle.
 
37
    //! Workers are executed on separate threads, and one worker may be
 
38
    //! responsible for dispatching events to multiple client connections.
 
39
    class Worker : XmlRpcRunnable {
 
40
    public:
 
41
      //! Constructor. Executes the run method in a separate thread.
 
42
      Worker() { _thread.setRunnable(this); _thread.start(); }
 
43
 
 
44
      //! Implement the Runnable interface
 
45
      void run();
 
46
 
 
47
    protected:
 
48
 
 
49
      //! The thread this worker is running in.
 
50
      XmlRpcThread _thread;
 
51
 
 
52
    };
 
53
 
 
54
 
 
55
    //! The worker pool
 
56
    std::vector<Worker> _workers;
 
57
 
 
58
 
 
59
    //! Serialize dispatcher access
 
60
    XmlRpcMutex _mutex;
 
61
 
 
62
 
 
63
  };  // class XmlRpcThreadedServer
 
64
 
 
65
}
 
66
 
 
67
#endif  // _XMLRPCTHREADEDSERVER_H_