reSIProcate
SIP stack, Dialog Usage Manager and related libraries
Loading...
Searching...
No Matches
Dispatcher.hxx
Go to the documentation of this file.
1#ifndef DISPATCHER_HXX
2#define DISPATCHER_HXX 1
3
8#include "rutil/RWMutex.hxx"
9#include "rutil/Lock.hxx"
10#include <vector>
11
12namespace resip
13{
14 class SipStack;
15 class ApplicationMessage;
16
38{
39 public:
40
51 Dispatcher(std::unique_ptr<Worker> prototype,
52 resip::SipStack* stack,
53 int workers=2,
54 bool startImmediately=true);
55
56 virtual ~Dispatcher();
57
69 virtual bool post(std::unique_ptr<resip::ApplicationMessage>& work);
70
74 size_t fifoCountDepth() const;
75
80 time_t fifoTimeDepth() const;
81
85 int workPoolSize() const;
86
92 void stop();
93
97 void resume();
98
102 void shutdownAll();
103
104
108 void startAll();
109
111
112
113 protected:
114
120
122
123 std::vector<WorkerThread*> mWorkerThreads;
124
125 private:
126 //No copying!
127 Dispatcher(const Dispatcher& toCopy);
128 Dispatcher& operator=(const Dispatcher& toCopy);
129};
130
131}
132
133#endif
134
135/* ====================================================================
136 * The Vovida Software License, Version 1.0
137 *
138 * Copyright (c) 2000 Vovida Networks, Inc. All rights reserved.
139 *
140 * Redistribution and use in source and binary forms, with or without
141 * modification, are permitted provided that the following conditions
142 * are met:
143 *
144 * 1. Redistributions of source code must retain the above copyright
145 * notice, this list of conditions and the following disclaimer.
146 *
147 * 2. Redistributions in binary form must reproduce the above copyright
148 * notice, this list of conditions and the following disclaimer in
149 * the documentation and/or other materials provided with the
150 * distribution.
151 *
152 * 3. The names "VOCAL", "Vovida Open Communication Application Library",
153 * and "Vovida Open Communication Application Library (VOCAL)" must
154 * not be used to endorse or promote products derived from this
155 * software without prior written permission. For written
156 * permission, please contact vocal@vovida.org.
157 *
158 * 4. Products derived from this software may not be called "VOCAL", nor
159 * may "VOCAL" appear in their name, without prior written
160 * permission of Vovida Networks, Inc.
161 *
162 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
163 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
164 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
165 * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL VOVIDA
166 * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
167 * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
168 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
169 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
170 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
171 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
172 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
173 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
174 * DAMAGE.
175 *
176 * ====================================================================
177 *
178 * This software consists of voluntary contributions made by Vovida
179 * Networks, Inc. and many individuals on behalf of Vovida Networks,
180 * Inc. For more information on Vovida Networks, Inc., please see
181 * <http://www.vovida.org/>.
182 *
183 */
A generic thread-bank class.
resip::TimeLimitFifo< resip::ApplicationMessage > mFifo
virtual bool post(std::unique_ptr< resip::ApplicationMessage > &work)
Posts a message to this thread bank.
std::vector< WorkerThread * > mWorkerThreads
void startAll()
Starts the thread bank.
int workPoolSize() const
void shutdownAll()
Shuts down the thread-bank.
void resume()
Resumes accepting work.
virtual ~Dispatcher()
Worker * mWorkerPrototype
time_t fifoTimeDepth() const
resip::RWMutex mMutex
void stop()
This Dispatcher will stop accepting new work, but processing will continue normally on the messages a...
resip::SipStack * mStack
size_t fifoCountDepth() const
Wraps the readers/writers mutex implementation on your platform.
Definition RWMutex.hxx:29
This is the primary point of interaction between the app-layer and the stack.
Definition SipStack.hxx:160
dcm! – add UnusedChecking(_enum) below;