reSIProcate
SIP stack, Dialog Usage Manager and related libraries
Loading...
Searching...
No Matches
InterruptableStackThread.cxx
Go to the documentation of this file.
5#include "rutil/Logger.hxx"
6
7#define RESIPROCATE_SUBSYSTEM Subsystem::SIP
8
9using namespace resip;
10
12 : mStack(stack),
13 mSelectInterruptor(si)
14{}
15
17{
18 //InfoLog (<< "InterruptableStackThread::~InterruptableStackThread()");
19}
20
21/*
22 * InterruptableStackThread uses the deprecated SipStack API calls,
23 * buildFdSet(fdset) and process(fdset).
24 *
25 * To avoid using these calls, use EventStackThread or call the
26 * new SipStack::process(unsigned int) directly.
27 */
28#ifndef WIN32
29#pragma GCC diagnostic push
30#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
31#else
32#pragma warning(push)
33#pragma warning(disable: 4996)
34#endif
35
36void
38{
39 while (!isShutdown())
40 {
41 try
42 {
43 FdSet fdset;
44 mStack.process(fdset); // .dcm. reqd to get send requests queued at transports
45 mSelectInterruptor.buildFdSet(fdset);
46 mStack.buildFdSet(fdset);
47 buildFdSet(fdset);
50 if (ret >= 0)
51 {
52 // .dlb. use return value to peak at the message to see if it is a
53 // shutdown, and call shutdown if it is
54 // .dcm. how will this interact w/ TuSelector?
55 mSelectInterruptor.process(fdset);
56 mStack.process(fdset);
57 process(fdset);
58 }
59 }
60 catch (BaseException& e)
61 {
62 ErrLog (<< "Unhandled exception: " << e);
63 }
64 }
65 InfoLog (<< "Shutting down stack thread");
66}
67
68#ifndef WIN32
69#pragma GCC diagnostic pop
70#else
71#pragma warning(pop)
72#endif
73
74void
76{
78 mSelectInterruptor.interrupt();
79}
80
81void
85
86unsigned int
88{
89 //.dcm. --- eventually make infinite
90 return 10000;
91}
92
93void
97
98/* ====================================================================
99 * The Vovida Software License, Version 1.0
100 *
101 * Copyright (c) 2000 Vovida Networks, Inc. All rights reserved.
102 *
103 * Redistribution and use in source and binary forms, with or without
104 * modification, are permitted provided that the following conditions
105 * are met:
106 *
107 * 1. Redistributions of source code must retain the above copyright
108 * notice, this list of conditions and the following disclaimer.
109 *
110 * 2. Redistributions in binary form must reproduce the above copyright
111 * notice, this list of conditions and the following disclaimer in
112 * the documentation and/or other materials provided with the
113 * distribution.
114 *
115 * 3. The names "VOCAL", "Vovida Open Communication Application Library",
116 * and "Vovida Open Communication Application Library (VOCAL)" must
117 * not be used to endorse or promote products derived from this
118 * software without prior written permission. For written
119 * permission, please contact vocal@vovida.org.
120 *
121 * 4. Products derived from this software may not be called "VOCAL", nor
122 * may "VOCAL" appear in their name, without prior written
123 * permission of Vovida Networks, Inc.
124 *
125 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
126 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
127 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
128 * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL VOVIDA
129 * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
130 * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
131 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
132 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
133 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
134 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
135 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
136 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
137 * DAMAGE.
138 *
139 * ====================================================================
140 *
141 * This software consists of voluntary contributions made by Vovida
142 * Networks, Inc. and many individuals on behalf of Vovida Networks,
143 * Inc. For more information on Vovida Networks, Inc., please see
144 * <http://www.vovida.org/>.
145 *
146 */
#define InfoLog(args_)
Definition Logger.hxx:131
#define ErrLog(args_)
Definition Logger.hxx:137
The abstract base-class for all exceptions thrown by resip code.
Object-oriented wrapper for your platform's file-descriptor set.
Definition Socket.hxx:162
int selectMilliSeconds(unsigned long ms)
Definition Socket.hxx:181
InterruptableStackThread(SipStack &stack, SelectInterruptor &si)
virtual unsigned int getTimeTillNextProcessMS() const
Used to 'artificially' interrupt a select call.
void process(FdSet &fdset)
cleanup signalled fd
void interrupt()
cause the 'artificial' fd to signal
void buildFdSet(FdSet &fdset)
Used to add the 'artificial' fd to the fdset that will be responsible for interrupting a subsequent s...
This is the primary point of interaction between the app-layer and the stack.
Definition SipStack.hxx:160
virtual void process(FdSet &fdset)
This allows the executive to give processing time to stack components.
virtual unsigned int getTimeTillNextProcessMS()
Returns time in milliseconds when process next needs to be called.
virtual void buildFdSet(FdSet &fdset)
Build the FD set to use in a select to find out when process(FdSet&) must be called again.
virtual void shutdown()
Definition ThreadIf.cxx:190
bool isShutdown() const
Definition ThreadIf.cxx:212
dcm! – add UnusedChecking(_enum) below;
const _Tp & resipMin(const _Tp &__a, const _Tp &__b)
Definition compat.hxx:182