diff options
Diffstat (limited to 'OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs')
-rw-r--r-- | OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs index 4be8bf4..7628e23 100644 --- a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs +++ b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs | |||
@@ -50,19 +50,26 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
50 | private uint m_WorkerThreadCount = 0; | 50 | private uint m_WorkerThreadCount = 0; |
51 | private Thread[] m_workerThreads; | 51 | private Thread[] m_workerThreads; |
52 | private PollServiceWorkerThread[] m_PollServiceWorkerThreads; | 52 | private PollServiceWorkerThread[] m_PollServiceWorkerThreads; |
53 | private bool m_running = true; | 53 | private volatile bool m_running = true; |
54 | private int m_pollTimeout; | ||
54 | 55 | ||
55 | public PollServiceRequestManager(BaseHttpServer pSrv, uint pWorkerThreadCount, int pTimeout) | 56 | public PollServiceRequestManager(BaseHttpServer pSrv, uint pWorkerThreadCount, int pTimeout) |
56 | { | 57 | { |
57 | m_server = pSrv; | 58 | m_server = pSrv; |
58 | m_WorkerThreadCount = pWorkerThreadCount; | 59 | m_WorkerThreadCount = pWorkerThreadCount; |
60 | m_pollTimeout = pTimeout; | ||
61 | } | ||
62 | |||
63 | public void Start() | ||
64 | { | ||
65 | m_running = true; | ||
59 | m_workerThreads = new Thread[m_WorkerThreadCount]; | 66 | m_workerThreads = new Thread[m_WorkerThreadCount]; |
60 | m_PollServiceWorkerThreads = new PollServiceWorkerThread[m_WorkerThreadCount]; | 67 | m_PollServiceWorkerThreads = new PollServiceWorkerThread[m_WorkerThreadCount]; |
61 | 68 | ||
62 | //startup worker threads | 69 | //startup worker threads |
63 | for (uint i = 0; i < m_WorkerThreadCount; i++) | 70 | for (uint i = 0; i < m_WorkerThreadCount; i++) |
64 | { | 71 | { |
65 | m_PollServiceWorkerThreads[i] = new PollServiceWorkerThread(m_server, pTimeout); | 72 | m_PollServiceWorkerThreads[i] = new PollServiceWorkerThread(m_server, m_pollTimeout); |
66 | m_PollServiceWorkerThreads[i].ReQueue += ReQueueEvent; | 73 | m_PollServiceWorkerThreads[i].ReQueue += ReQueueEvent; |
67 | 74 | ||
68 | m_workerThreads[i] | 75 | m_workerThreads[i] |
@@ -141,8 +148,10 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
141 | 148 | ||
142 | } | 149 | } |
143 | 150 | ||
144 | ~PollServiceRequestManager() | 151 | public void Stop() |
145 | { | 152 | { |
153 | m_running = false; | ||
154 | |||
146 | foreach (object o in m_requests) | 155 | foreach (object o in m_requests) |
147 | { | 156 | { |
148 | PollServiceHttpRequest req = (PollServiceHttpRequest) o; | 157 | PollServiceHttpRequest req = (PollServiceHttpRequest) o; |
@@ -157,7 +166,6 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
157 | { | 166 | { |
158 | t.Abort(); | 167 | t.Abort(); |
159 | } | 168 | } |
160 | m_running = false; | ||
161 | } | 169 | } |
162 | } | 170 | } |
163 | } | 171 | } |
@@ -337,7 +345,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
337 | if (responsedata == null) | 345 | if (responsedata == null) |
338 | continue; | 346 | continue; |
339 | 347 | ||
340 | if (req.PollServiceArgs.Type == PollServiceEventArgs.EventType.Normal) | 348 | if (req.PollServiceArgs.Type == PollServiceEventArgs.EventType.Normal) // This is the event queue |
341 | { | 349 | { |
342 | try | 350 | try |
343 | { | 351 | { |