zeroc-ice 3.7.9.1 → 3.7.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/ext/ice/cpp/include/Ice/Config.h +5 -7
- data/ext/ice/cpp/include/Ice/ConsoleUtil.h +1 -1
- data/ext/ice/cpp/include/Ice/Ice.h +2 -2
- data/ext/ice/cpp/include/Ice/SHA1.h +0 -2
- data/ext/ice/cpp/include/IceSSL/IceSSL.h +3 -7
- data/ext/ice/cpp/include/IceUtil/Config.h +12 -44
- data/ext/ice/cpp/include/IceUtil/ConsoleUtil.h +1 -1
- data/ext/ice/cpp/include/IceUtil/FileUtil.h +0 -3
- data/ext/ice/cpp/include/IceUtil/IceUtil.h +1 -1
- data/ext/ice/cpp/include/IceUtil/Mutex.h +0 -4
- data/ext/ice/cpp/include/IceUtil/ResourceConfig.h +5 -21
- data/ext/ice/cpp/include/IceUtil/Thread.h +4 -18
- data/ext/ice/cpp/include/IceUtil/Timer.h +1 -0
- data/ext/ice/cpp/include/generated/Ice/BuiltinSequences.h +2 -2
- data/ext/ice/cpp/include/generated/Ice/Communicator.h +2 -2
- data/ext/ice/cpp/include/generated/Ice/CommunicatorF.h +2 -2
- data/ext/ice/cpp/include/generated/Ice/Connection.h +2 -2
- data/ext/ice/cpp/include/generated/Ice/ConnectionF.h +2 -2
- data/ext/ice/cpp/include/generated/Ice/Current.h +4 -4
- data/ext/ice/cpp/include/generated/Ice/Endpoint.h +2 -2
- data/ext/ice/cpp/include/generated/Ice/EndpointF.h +2 -2
- data/ext/ice/cpp/include/generated/Ice/EndpointTypes.h +2 -2
- data/ext/ice/cpp/include/generated/Ice/FacetMap.h +2 -2
- data/ext/ice/cpp/include/generated/Ice/Identity.h +2 -2
- data/ext/ice/cpp/include/generated/Ice/ImplicitContext.h +2 -2
- data/ext/ice/cpp/include/generated/Ice/ImplicitContextF.h +2 -2
- data/ext/ice/cpp/include/generated/Ice/Instrumentation.h +2 -2
- data/ext/ice/cpp/include/generated/Ice/InstrumentationF.h +2 -2
- data/ext/ice/cpp/include/generated/Ice/LocalException.h +2 -2
- data/ext/ice/cpp/include/generated/Ice/Locator.h +2 -2
- data/ext/ice/cpp/include/generated/Ice/LocatorF.h +2 -2
- data/ext/ice/cpp/include/generated/Ice/Logger.h +2 -2
- data/ext/ice/cpp/include/generated/Ice/LoggerF.h +2 -2
- data/ext/ice/cpp/include/generated/Ice/Metrics.h +2 -2
- data/ext/ice/cpp/include/generated/Ice/ObjectAdapter.h +2 -2
- data/ext/ice/cpp/include/generated/Ice/ObjectAdapterF.h +2 -2
- data/ext/ice/cpp/include/generated/Ice/ObjectFactory.h +2 -2
- data/ext/ice/cpp/include/generated/Ice/Plugin.h +2 -2
- data/ext/ice/cpp/include/generated/Ice/PluginF.h +2 -2
- data/ext/ice/cpp/include/generated/Ice/Process.h +2 -2
- data/ext/ice/cpp/include/generated/Ice/ProcessF.h +2 -2
- data/ext/ice/cpp/include/generated/Ice/Properties.h +8 -8
- data/ext/ice/cpp/include/generated/Ice/PropertiesAdmin.h +2 -2
- data/ext/ice/cpp/include/generated/Ice/PropertiesF.h +2 -2
- data/ext/ice/cpp/include/generated/Ice/RemoteLogger.h +2 -2
- data/ext/ice/cpp/include/generated/Ice/Router.h +2 -2
- data/ext/ice/cpp/include/generated/Ice/RouterF.h +2 -2
- data/ext/ice/cpp/include/generated/Ice/ServantLocator.h +2 -2
- data/ext/ice/cpp/include/generated/Ice/ServantLocatorF.h +2 -2
- data/ext/ice/cpp/include/generated/Ice/SliceChecksumDict.h +2 -2
- data/ext/ice/cpp/include/generated/Ice/ValueFactory.h +2 -2
- data/ext/ice/cpp/include/generated/Ice/Version.h +2 -2
- data/ext/ice/cpp/include/generated/IceSSL/ConnectionInfo.h +2 -2
- data/ext/ice/cpp/include/generated/IceSSL/ConnectionInfoF.h +2 -2
- data/ext/ice/cpp/include/generated/IceSSL/EndpointInfo.h +2 -2
- data/ext/ice/cpp/src/Ice/Acceptor.h +1 -1
- data/ext/ice/cpp/src/Ice/BuiltinSequences.cpp +2 -2
- data/ext/ice/cpp/src/Ice/Communicator.cpp +2 -2
- data/ext/ice/cpp/src/Ice/CommunicatorF.cpp +2 -2
- data/ext/ice/cpp/src/Ice/Connection.cpp +2 -2
- data/ext/ice/cpp/src/Ice/ConnectionF.cpp +2 -2
- data/ext/ice/cpp/src/Ice/ConnectionFactory.cpp +1 -1
- data/ext/ice/cpp/src/Ice/ConnectionFactory.h +2 -2
- data/ext/ice/cpp/src/Ice/ConnectionI.cpp +5 -5
- data/ext/ice/cpp/src/Ice/ConnectionI.h +6 -8
- data/ext/ice/cpp/src/Ice/CountDownLatch.cpp +0 -8
- data/ext/ice/cpp/src/Ice/Current.cpp +2 -2
- data/ext/ice/cpp/src/Ice/DefaultsAndOverrides.cpp +0 -2
- data/ext/ice/cpp/src/Ice/DynamicLibrary.cpp +2 -9
- data/ext/ice/cpp/src/Ice/Endpoint.cpp +2 -2
- data/ext/ice/cpp/src/Ice/EndpointF.cpp +2 -2
- data/ext/ice/cpp/src/Ice/EndpointTypes.cpp +2 -2
- data/ext/ice/cpp/src/Ice/EventHandler.cpp +1 -1
- data/ext/ice/cpp/src/Ice/EventHandler.h +2 -2
- data/ext/ice/cpp/src/Ice/Exception.cpp +0 -27
- data/ext/ice/cpp/src/Ice/FacetMap.cpp +2 -2
- data/ext/ice/cpp/src/Ice/IPEndpointI.cpp +0 -46
- data/ext/ice/cpp/src/Ice/IPEndpointI.h +1 -11
- data/ext/ice/cpp/src/Ice/Identity.cpp +2 -2
- data/ext/ice/cpp/src/Ice/ImplicitContext.cpp +2 -2
- data/ext/ice/cpp/src/Ice/ImplicitContextF.cpp +2 -2
- data/ext/ice/cpp/src/Ice/Instance.cpp +2 -6
- data/ext/ice/cpp/src/Ice/Instrumentation.cpp +2 -2
- data/ext/ice/cpp/src/Ice/InstrumentationF.cpp +2 -2
- data/ext/ice/cpp/src/Ice/LocalException.cpp +2 -2
- data/ext/ice/cpp/src/Ice/Locator.cpp +2 -2
- data/ext/ice/cpp/src/Ice/LocatorF.cpp +2 -2
- data/ext/ice/cpp/src/Ice/Logger.cpp +2 -2
- data/ext/ice/cpp/src/Ice/LoggerF.cpp +2 -2
- data/ext/ice/cpp/src/Ice/LoggerI.cpp +1 -3
- data/ext/ice/cpp/src/Ice/Metrics.cpp +2 -2
- data/ext/ice/cpp/src/Ice/Network.cpp +15 -841
- data/ext/ice/cpp/src/Ice/Network.h +4 -86
- data/ext/ice/cpp/src/Ice/NetworkF.h +0 -4
- data/ext/ice/cpp/src/Ice/NetworkProxy.cpp +0 -13
- data/ext/ice/cpp/src/Ice/ObjectAdapter.cpp +2 -2
- data/ext/ice/cpp/src/Ice/ObjectAdapterF.cpp +2 -2
- data/ext/ice/cpp/src/Ice/ObjectFactory.cpp +2 -2
- data/ext/ice/cpp/src/Ice/Plugin.cpp +2 -2
- data/ext/ice/cpp/src/Ice/PluginF.cpp +2 -2
- data/ext/ice/cpp/src/Ice/Process.cpp +2 -2
- data/ext/ice/cpp/src/Ice/ProcessF.cpp +2 -2
- data/ext/ice/cpp/src/Ice/Properties.cpp +2 -2
- data/ext/ice/cpp/src/Ice/PropertiesAdmin.cpp +2 -2
- data/ext/ice/cpp/src/Ice/PropertiesF.cpp +2 -2
- data/ext/ice/cpp/src/Ice/PropertiesI.cpp +4 -12
- data/ext/ice/cpp/src/Ice/RemoteLogger.cpp +2 -2
- data/ext/ice/cpp/src/Ice/Router.cpp +2 -2
- data/ext/ice/cpp/src/Ice/RouterF.cpp +2 -2
- data/ext/ice/cpp/src/Ice/SHA1.cpp +27 -43
- data/ext/ice/cpp/src/Ice/Selector.cpp +1 -13
- data/ext/ice/cpp/src/Ice/Selector.h +1 -17
- data/ext/ice/cpp/src/Ice/ServantLocator.cpp +2 -2
- data/ext/ice/cpp/src/Ice/ServantLocatorF.cpp +2 -2
- data/ext/ice/cpp/src/Ice/SliceChecksumDict.cpp +2 -2
- data/ext/ice/cpp/src/Ice/StreamSocket.cpp +4 -167
- data/ext/ice/cpp/src/Ice/StreamSocket.h +3 -10
- data/ext/ice/cpp/src/Ice/TcpAcceptor.cpp +0 -121
- data/ext/ice/cpp/src/Ice/TcpAcceptor.h +2 -10
- data/ext/ice/cpp/src/Ice/TcpTransceiver.cpp +1 -1
- data/ext/ice/cpp/src/Ice/TcpTransceiver.h +1 -1
- data/ext/ice/cpp/src/Ice/Thread.cpp +1 -243
- data/ext/ice/cpp/src/Ice/ThreadPool.cpp +15 -51
- data/ext/ice/cpp/src/Ice/ThreadPool.h +6 -6
- data/ext/ice/cpp/src/Ice/Transceiver.h +1 -1
- data/ext/ice/cpp/src/Ice/UdpConnector.cpp +0 -5
- data/ext/ice/cpp/src/Ice/UdpTransceiver.cpp +13 -360
- data/ext/ice/cpp/src/Ice/UdpTransceiver.h +2 -23
- data/ext/ice/cpp/src/Ice/ValueFactory.cpp +2 -2
- data/ext/ice/cpp/src/Ice/Version.cpp +2 -2
- data/ext/ice/cpp/src/Ice/WSAcceptor.cpp +2 -2
- data/ext/ice/cpp/src/Ice/WSAcceptor.h +2 -2
- data/ext/ice/cpp/src/Ice/WSTransceiver.cpp +2 -45
- data/ext/ice/cpp/src/Ice/WSTransceiver.h +2 -2
- data/ext/ice/cpp/src/IceDiscovery/IceDiscovery.cpp +2 -2
- data/ext/ice/cpp/src/IceDiscovery/IceDiscovery.h +2 -2
- data/ext/ice/cpp/src/IceLocatorDiscovery/IceLocatorDiscovery.cpp +2 -2
- data/ext/ice/cpp/src/IceLocatorDiscovery/IceLocatorDiscovery.h +2 -2
- data/ext/ice/cpp/src/IceSSL/AcceptorI.cpp +2 -2
- data/ext/ice/cpp/src/IceSSL/AcceptorI.h +2 -2
- data/ext/ice/cpp/src/IceSSL/ConnectionInfo.cpp +2 -2
- data/ext/ice/cpp/src/IceSSL/ConnectionInfoF.cpp +2 -2
- data/ext/ice/cpp/src/IceSSL/EndpointInfo.cpp +2 -2
- data/ext/ice/cpp/src/IceSSL/Util.cpp +1 -1
- data/ext/ice/cpp/src/IceUtil/ConsoleUtil.cpp +1 -1
- data/ext/ice/cpp/src/IceUtil/FileUtil.cpp +4 -17
- data/ext/ice/cpp/src/IceUtil/RecMutex.cpp +0 -4
- data/ext/ice/cpp/src/IceUtil/StringUtil.cpp +0 -45
- data/ext/ice/cpp/src/IceUtil/UUID.cpp +2 -6
- data/ext/ice/cpp/src/IceUtil/UtilException.cpp +1 -1
- data/ext/ice/cpp/src/Slice/JavaUtil.cpp +22 -0
- data/ext/ice/cpp/src/Slice/JavaUtil.h +9 -0
- data/ext/ice/mcpp/system.c +0 -4
- data/ice.gemspec +1 -1
- data/lib/Glacier2/Metrics.rb +1 -1
- data/lib/Glacier2/PermissionsVerifier.rb +1 -1
- data/lib/Glacier2/PermissionsVerifierF.rb +1 -1
- data/lib/Glacier2/Router.rb +1 -1
- data/lib/Glacier2/RouterF.rb +1 -1
- data/lib/Glacier2/SSLInfo.rb +1 -1
- data/lib/Glacier2/Session.rb +1 -1
- data/lib/Ice/BuiltinSequences.rb +1 -1
- data/lib/Ice/Communicator.rb +1 -1
- data/lib/Ice/CommunicatorF.rb +1 -1
- data/lib/Ice/Connection.rb +1 -1
- data/lib/Ice/ConnectionF.rb +1 -1
- data/lib/Ice/Current.rb +1 -1
- data/lib/Ice/Endpoint.rb +1 -1
- data/lib/Ice/EndpointF.rb +1 -1
- data/lib/Ice/EndpointTypes.rb +1 -1
- data/lib/Ice/FacetMap.rb +1 -1
- data/lib/Ice/Identity.rb +1 -1
- data/lib/Ice/ImplicitContext.rb +1 -1
- data/lib/Ice/ImplicitContextF.rb +1 -1
- data/lib/Ice/Instrumentation.rb +1 -1
- data/lib/Ice/InstrumentationF.rb +1 -1
- data/lib/Ice/LocalException.rb +1 -1
- data/lib/Ice/Locator.rb +1 -1
- data/lib/Ice/LocatorF.rb +1 -1
- data/lib/Ice/Logger.rb +1 -1
- data/lib/Ice/LoggerF.rb +1 -1
- data/lib/Ice/Metrics.rb +1 -1
- data/lib/Ice/ObjectAdapter.rb +1 -1
- data/lib/Ice/ObjectAdapterF.rb +1 -1
- data/lib/Ice/ObjectFactory.rb +1 -1
- data/lib/Ice/Plugin.rb +1 -1
- data/lib/Ice/PluginF.rb +1 -1
- data/lib/Ice/Process.rb +1 -1
- data/lib/Ice/ProcessF.rb +1 -1
- data/lib/Ice/Properties.rb +1 -1
- data/lib/Ice/PropertiesAdmin.rb +1 -1
- data/lib/Ice/PropertiesF.rb +1 -1
- data/lib/Ice/RemoteLogger.rb +1 -1
- data/lib/Ice/Router.rb +1 -1
- data/lib/Ice/RouterF.rb +1 -1
- data/lib/Ice/ServantLocator.rb +1 -1
- data/lib/Ice/ServantLocatorF.rb +1 -1
- data/lib/Ice/SliceChecksumDict.rb +1 -1
- data/lib/Ice/ValueFactory.rb +1 -1
- data/lib/Ice/Version.rb +1 -1
- data/lib/IceBox/IceBox.rb +1 -1
- data/lib/IceGrid/Admin.rb +1 -1
- data/lib/IceGrid/Descriptor.rb +1 -1
- data/lib/IceGrid/Exception.rb +1 -1
- data/lib/IceGrid/FileParser.rb +1 -1
- data/lib/IceGrid/PluginFacade.rb +1 -1
- data/lib/IceGrid/Registry.rb +1 -1
- data/lib/IceGrid/Session.rb +1 -1
- data/lib/IceGrid/UserAccountMapper.rb +1 -1
- data/lib/IcePatch2/FileInfo.rb +1 -1
- data/lib/IcePatch2/FileServer.rb +1 -1
- data/lib/IceStorm/IceStorm.rb +1 -1
- data/lib/IceStorm/Metrics.rb +1 -1
- data/slice/Ice/Current.ice +1 -1
- data/slice/Ice/Properties.ice +3 -3
- metadata +3 -3
@@ -18,10 +18,6 @@
|
|
18
18
|
#include <climits>
|
19
19
|
#include <exception>
|
20
20
|
|
21
|
-
#ifdef ICE_OS_UWP
|
22
|
-
# include <thread>
|
23
|
-
#endif
|
24
|
-
|
25
21
|
#ifndef _WIN32
|
26
22
|
#include <sys/time.h>
|
27
23
|
#include <sys/resource.h>
|
@@ -30,245 +26,7 @@
|
|
30
26
|
using namespace std;
|
31
27
|
using namespace IceInternal;
|
32
28
|
|
33
|
-
#
|
34
|
-
|
35
|
-
IceUtil::ThreadControl::ThreadControl() :
|
36
|
-
_id(this_thread::get_id())
|
37
|
-
{
|
38
|
-
}
|
39
|
-
|
40
|
-
IceUtil::ThreadControl::ThreadControl(const shared_ptr<thread>& thread) :
|
41
|
-
_thread(thread),
|
42
|
-
_id(_thread->get_id())
|
43
|
-
{
|
44
|
-
}
|
45
|
-
|
46
|
-
bool
|
47
|
-
IceUtil::ThreadControl::operator==(const ThreadControl& rhs) const
|
48
|
-
{
|
49
|
-
return id() == rhs.id();
|
50
|
-
}
|
51
|
-
|
52
|
-
bool
|
53
|
-
IceUtil::ThreadControl::operator!=(const ThreadControl& rhs) const
|
54
|
-
{
|
55
|
-
return id() != rhs.id();
|
56
|
-
}
|
57
|
-
|
58
|
-
void
|
59
|
-
IceUtil::ThreadControl::join()
|
60
|
-
{
|
61
|
-
if(!_thread)
|
62
|
-
{
|
63
|
-
throw BadThreadControlException(__FILE__, __LINE__);
|
64
|
-
}
|
65
|
-
|
66
|
-
try
|
67
|
-
{
|
68
|
-
_thread->join();
|
69
|
-
}
|
70
|
-
catch(const system_error& ex)
|
71
|
-
{
|
72
|
-
throw ThreadSyscallException(__FILE__, __LINE__, ex.code().value());
|
73
|
-
}
|
74
|
-
}
|
75
|
-
|
76
|
-
void
|
77
|
-
IceUtil::ThreadControl::detach()
|
78
|
-
{
|
79
|
-
if(!_thread)
|
80
|
-
{
|
81
|
-
throw BadThreadControlException(__FILE__, __LINE__);
|
82
|
-
}
|
83
|
-
|
84
|
-
try
|
85
|
-
{
|
86
|
-
_thread->detach();
|
87
|
-
}
|
88
|
-
catch(const system_error& ex)
|
89
|
-
{
|
90
|
-
throw ThreadSyscallException(__FILE__, __LINE__, ex.code().value());
|
91
|
-
}
|
92
|
-
}
|
93
|
-
|
94
|
-
IceUtil::ThreadControl::ID
|
95
|
-
IceUtil::ThreadControl::id() const
|
96
|
-
{
|
97
|
-
return _id;
|
98
|
-
}
|
99
|
-
|
100
|
-
void
|
101
|
-
IceUtil::ThreadControl::sleep(const Time& timeout)
|
102
|
-
{
|
103
|
-
IceUtil::Int64 msTimeout = timeout.toMilliSeconds();
|
104
|
-
if(msTimeout < 0 || msTimeout > 0x7FFFFFFF)
|
105
|
-
{
|
106
|
-
throw IceUtil::InvalidTimeoutException(__FILE__, __LINE__, timeout);
|
107
|
-
}
|
108
|
-
this_thread::sleep_for(chrono::microseconds(timeout.toMicroSeconds()));
|
109
|
-
}
|
110
|
-
|
111
|
-
void
|
112
|
-
IceUtil::ThreadControl::yield()
|
113
|
-
{
|
114
|
-
this_thread::yield();
|
115
|
-
}
|
116
|
-
|
117
|
-
IceUtil::Thread::Thread() :
|
118
|
-
_started(false),
|
119
|
-
_running(false)
|
120
|
-
{
|
121
|
-
}
|
122
|
-
|
123
|
-
IceUtil::Thread::Thread(const string& name) :
|
124
|
-
_name(name),
|
125
|
-
_started(false),
|
126
|
-
_running(false)
|
127
|
-
{
|
128
|
-
}
|
129
|
-
|
130
|
-
IceUtil::Thread::~Thread()
|
131
|
-
{
|
132
|
-
}
|
133
|
-
|
134
|
-
static unsigned int
|
135
|
-
WINAPI startHook(void* arg)
|
136
|
-
{
|
137
|
-
// Ensure that the thread doesn't go away until run() has
|
138
|
-
// completed.
|
139
|
-
//
|
140
|
-
IceUtil::ThreadPtr thread;
|
141
|
-
|
142
|
-
try
|
143
|
-
{
|
144
|
-
IceUtil::Thread* rawThread = static_cast<IceUtil::Thread*>(arg);
|
145
|
-
|
146
|
-
//
|
147
|
-
// Ensure that the thread doesn't go away until run() has
|
148
|
-
// completed.
|
149
|
-
//
|
150
|
-
thread = rawThread;
|
151
|
-
|
152
|
-
//
|
153
|
-
// Initialize the random number generator in each thread on
|
154
|
-
// Windows (the rand() seed is thread specific).
|
155
|
-
//
|
156
|
-
unsigned int seed = static_cast<unsigned int>(IceUtil::Time::now().toMicroSeconds());
|
157
|
-
srand(seed ^ static_cast<unsigned int>(hash<thread::id>()(thread->getThreadControl().id())));
|
158
|
-
|
159
|
-
//
|
160
|
-
// See the comment in IceUtil::Thread::start() for details.
|
161
|
-
//
|
162
|
-
rawThread->__decRef();
|
163
|
-
thread->run();
|
164
|
-
}
|
165
|
-
catch(...)
|
166
|
-
{
|
167
|
-
if(!thread->name().empty())
|
168
|
-
{
|
169
|
-
consoleErr << thread->name() << " terminating" << endl;
|
170
|
-
}
|
171
|
-
std::terminate();
|
172
|
-
}
|
173
|
-
|
174
|
-
thread->_done();
|
175
|
-
|
176
|
-
return 0;
|
177
|
-
}
|
178
|
-
|
179
|
-
#include <process.h>
|
180
|
-
|
181
|
-
IceUtil::ThreadControl
|
182
|
-
IceUtil::Thread::start(size_t)
|
183
|
-
{
|
184
|
-
return start(0, 0);
|
185
|
-
}
|
186
|
-
|
187
|
-
IceUtil::ThreadControl
|
188
|
-
IceUtil::Thread::start(size_t, int)
|
189
|
-
{
|
190
|
-
//
|
191
|
-
// Keep this alive for the duration of start
|
192
|
-
//
|
193
|
-
IceUtil::ThreadPtr keepMe = this;
|
194
|
-
|
195
|
-
IceUtil::Mutex::Lock lock(_stateMutex);
|
196
|
-
|
197
|
-
if(_started)
|
198
|
-
{
|
199
|
-
throw ThreadStartedException(__FILE__, __LINE__);
|
200
|
-
}
|
201
|
-
|
202
|
-
//
|
203
|
-
// It's necessary to increment the reference count since the
|
204
|
-
// thread constructor won't necessarily call the thread function until
|
205
|
-
// later. If the user does (new MyThread)->start() then the thread
|
206
|
-
// object could be deleted before the thread object takes
|
207
|
-
// ownership. It's also necessary to increment the reference count
|
208
|
-
// prior to calling the thread constructor since the thread start hook
|
209
|
-
// itself calls __decRef().
|
210
|
-
//
|
211
|
-
try
|
212
|
-
{
|
213
|
-
__incRef();
|
214
|
-
_thread.reset(new thread(startHook, this));
|
215
|
-
}
|
216
|
-
catch(const std::system_error&)
|
217
|
-
{
|
218
|
-
__decRef();
|
219
|
-
throw;
|
220
|
-
}
|
221
|
-
|
222
|
-
_started = true;
|
223
|
-
_running = true;
|
224
|
-
|
225
|
-
return ThreadControl(_thread);
|
226
|
-
}
|
227
|
-
|
228
|
-
IceUtil::ThreadControl
|
229
|
-
IceUtil::Thread::getThreadControl() const
|
230
|
-
{
|
231
|
-
IceUtil::Mutex::Lock lock(_stateMutex);
|
232
|
-
if(!_started)
|
233
|
-
{
|
234
|
-
throw ThreadNotStartedException(__FILE__, __LINE__);
|
235
|
-
}
|
236
|
-
return ThreadControl(_thread);
|
237
|
-
}
|
238
|
-
|
239
|
-
bool
|
240
|
-
IceUtil::Thread::operator==(const Thread& rhs) const
|
241
|
-
{
|
242
|
-
return this == &rhs;
|
243
|
-
}
|
244
|
-
|
245
|
-
bool
|
246
|
-
IceUtil::Thread::operator<(const Thread& rhs) const
|
247
|
-
{
|
248
|
-
return this < &rhs;
|
249
|
-
}
|
250
|
-
|
251
|
-
bool
|
252
|
-
IceUtil::Thread::isAlive() const
|
253
|
-
{
|
254
|
-
IceUtil::Mutex::Lock lock(_stateMutex);
|
255
|
-
return _running;
|
256
|
-
}
|
257
|
-
|
258
|
-
void
|
259
|
-
IceUtil::Thread::_done()
|
260
|
-
{
|
261
|
-
IceUtil::Mutex::Lock lock(_stateMutex);
|
262
|
-
_running = false;
|
263
|
-
}
|
264
|
-
|
265
|
-
const string&
|
266
|
-
IceUtil::Thread::name() const
|
267
|
-
{
|
268
|
-
return _name;
|
269
|
-
}
|
270
|
-
|
271
|
-
#elif defined(_WIN32)
|
29
|
+
#if defined(_WIN32)
|
272
30
|
|
273
31
|
IceUtil::ThreadControl::ThreadControl() :
|
274
32
|
_handle(0),
|
@@ -13,10 +13,6 @@
|
|
13
13
|
#include <Ice/Properties.h>
|
14
14
|
#include <Ice/TraceLevels.h>
|
15
15
|
|
16
|
-
#if defined(ICE_OS_UWP)
|
17
|
-
# include <Ice/StringConverter.h>
|
18
|
-
#endif
|
19
|
-
|
20
16
|
#if defined(__FreeBSD__)
|
21
17
|
# include <sys/sysctl.h>
|
22
18
|
#endif
|
@@ -177,7 +173,7 @@ IceInternal::ThreadPoolWorkQueue::destroy()
|
|
177
173
|
//Lock sync(*this); Called with the thread pool locked
|
178
174
|
assert(!_destroyed);
|
179
175
|
_destroyed = true;
|
180
|
-
#if defined(ICE_USE_IOCP)
|
176
|
+
#if defined(ICE_USE_IOCP)
|
181
177
|
_threadPool._selector.completed(this, SocketOperationRead);
|
182
178
|
#else
|
183
179
|
_threadPool._selector.ready(this, SocketOperationRead, true);
|
@@ -189,7 +185,7 @@ IceInternal::ThreadPoolWorkQueue::queue(const ThreadPoolWorkItemPtr& item)
|
|
189
185
|
{
|
190
186
|
//Lock sync(*this); Called with the thread pool locked
|
191
187
|
_workItems.push_back(item);
|
192
|
-
#if defined(ICE_USE_IOCP)
|
188
|
+
#if defined(ICE_USE_IOCP)
|
193
189
|
_threadPool._selector.completed(this, SocketOperationRead);
|
194
190
|
#else
|
195
191
|
if(_workItems.size() == 1)
|
@@ -199,7 +195,7 @@ IceInternal::ThreadPoolWorkQueue::queue(const ThreadPoolWorkItemPtr& item)
|
|
199
195
|
#endif
|
200
196
|
}
|
201
197
|
|
202
|
-
#if defined(ICE_USE_IOCP)
|
198
|
+
#if defined(ICE_USE_IOCP)
|
203
199
|
bool
|
204
200
|
IceInternal::ThreadPoolWorkQueue::startAsync(SocketOperation)
|
205
201
|
{
|
@@ -226,7 +222,7 @@ IceInternal::ThreadPoolWorkQueue::message(ThreadPoolCurrent& current)
|
|
226
222
|
workItem = _workItems.front();
|
227
223
|
_workItems.pop_front();
|
228
224
|
}
|
229
|
-
#if defined(ICE_USE_IOCP)
|
225
|
+
#if defined(ICE_USE_IOCP)
|
230
226
|
else
|
231
227
|
{
|
232
228
|
assert(_destroyed);
|
@@ -293,19 +289,18 @@ IceInternal::ThreadPool::ThreadPool(const InstancePtr& instance, const string& p
|
|
293
289
|
_threadIdleTime(0),
|
294
290
|
_stackSize(0),
|
295
291
|
_inUse(0),
|
296
|
-
#if !defined(ICE_USE_IOCP)
|
292
|
+
#if !defined(ICE_USE_IOCP)
|
297
293
|
_inUseIO(0),
|
298
294
|
_nextHandler(_handlers.end()),
|
299
295
|
#endif
|
300
296
|
_promote(true)
|
301
297
|
{
|
302
298
|
PropertiesPtr properties = _instance->initializationData().properties;
|
303
|
-
#
|
304
|
-
# ifdef _WIN32
|
299
|
+
#ifdef _WIN32
|
305
300
|
SYSTEM_INFO sysInfo;
|
306
301
|
GetSystemInfo(&sysInfo);
|
307
302
|
int nProcessors = sysInfo.dwNumberOfProcessors;
|
308
|
-
#
|
303
|
+
#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
|
309
304
|
static int ncpu[2] = { CTL_HW, HW_NCPU };
|
310
305
|
int nProcessors;
|
311
306
|
size_t sz = sizeof(nProcessors);
|
@@ -313,13 +308,12 @@ IceInternal::ThreadPool::ThreadPool(const InstancePtr& instance, const string& p
|
|
313
308
|
{
|
314
309
|
nProcessors = 1;
|
315
310
|
}
|
316
|
-
#
|
311
|
+
#else
|
317
312
|
int nProcessors = static_cast<int>(sysconf(_SC_NPROCESSORS_ONLN));
|
318
313
|
if(nProcessors == -1)
|
319
314
|
{
|
320
315
|
nProcessors = 1;
|
321
316
|
}
|
322
|
-
# endif
|
323
317
|
#endif
|
324
318
|
|
325
319
|
//
|
@@ -336,12 +330,11 @@ IceInternal::ThreadPool::ThreadPool(const InstancePtr& instance, const string& p
|
|
336
330
|
}
|
337
331
|
|
338
332
|
int sizeMax = properties->getPropertyAsIntWithDefault(_prefix + ".SizeMax", size);
|
339
|
-
#ifndef ICE_OS_UWP
|
340
333
|
if(sizeMax == -1)
|
341
334
|
{
|
342
335
|
sizeMax = nProcessors;
|
343
336
|
}
|
344
|
-
|
337
|
+
|
345
338
|
if(sizeMax < size)
|
346
339
|
{
|
347
340
|
Warning out(_instance->initializationData().logger);
|
@@ -374,11 +367,7 @@ IceInternal::ThreadPool::ThreadPool(const InstancePtr& instance, const string& p
|
|
374
367
|
const_cast<int&>(_size) = size;
|
375
368
|
const_cast<int&>(_sizeMax) = sizeMax;
|
376
369
|
const_cast<int&>(_sizeWarn) = sizeWarn;
|
377
|
-
#ifndef ICE_OS_UWP
|
378
370
|
const_cast<int&>(_sizeIO) = min(sizeMax, nProcessors);
|
379
|
-
#else
|
380
|
-
const_cast<int&>(_sizeIO) = sizeMax;
|
381
|
-
#endif
|
382
371
|
const_cast<int&>(_threadIdleTime) = threadIdleTime;
|
383
372
|
|
384
373
|
#ifdef ICE_USE_IOCP
|
@@ -543,7 +532,7 @@ IceInternal::ThreadPool::finish(const EventHandlerPtr& handler, bool closeNow)
|
|
543
532
|
{
|
544
533
|
Lock sync(*this);
|
545
534
|
assert(!_destroyed);
|
546
|
-
#if !defined(ICE_USE_IOCP)
|
535
|
+
#if !defined(ICE_USE_IOCP)
|
547
536
|
closeNow = _selector.finish(handler.get(), closeNow); // This must be called before!
|
548
537
|
_workQueue->queue(new FinishedWorkItem(handler, !closeNow));
|
549
538
|
return closeNow;
|
@@ -670,7 +659,7 @@ IceInternal::ThreadPool::getDispatchQueue() const ICE_NOEXCEPT
|
|
670
659
|
void
|
671
660
|
IceInternal::ThreadPool::run(const EventHandlerThreadPtr& thread)
|
672
661
|
{
|
673
|
-
#if !defined(ICE_USE_IOCP)
|
662
|
+
#if !defined(ICE_USE_IOCP)
|
674
663
|
ThreadPoolCurrent current(_instance, this, thread);
|
675
664
|
bool select = false;
|
676
665
|
while(true)
|
@@ -824,12 +813,8 @@ IceInternal::ThreadPool::run(const EventHandlerThreadPtr& thread)
|
|
824
813
|
try
|
825
814
|
{
|
826
815
|
current._ioCompleted = false;
|
827
|
-
#ifdef ICE_OS_UWP
|
828
|
-
current._handler = ICE_GET_SHARED_FROM_THIS(_selector.getNextHandler(current.operation, _threadIdleTime));
|
829
|
-
#else
|
830
816
|
current._handler = ICE_GET_SHARED_FROM_THIS(_selector.getNextHandler(current.operation, current._count,
|
831
817
|
current._error, _threadIdleTime));
|
832
|
-
#endif
|
833
818
|
}
|
834
819
|
catch(const SelectorTimeoutException&)
|
835
820
|
{
|
@@ -843,14 +828,13 @@ IceInternal::ThreadPool::run(const EventHandlerThreadPtr& thread)
|
|
843
828
|
}
|
844
829
|
else if(_inUse < static_cast<int>(_threads.size() - 1)) // If not the last idle thread, we can exit.
|
845
830
|
{
|
846
|
-
#ifndef ICE_OS_UWP
|
847
831
|
BOOL hasIO = false;
|
848
832
|
GetThreadIOPendingFlag(GetCurrentThread(), &hasIO);
|
849
833
|
if(hasIO)
|
850
834
|
{
|
851
835
|
continue;
|
852
836
|
}
|
853
|
-
|
837
|
+
|
854
838
|
if(_instance->traceLevels()->threadPool >= 1)
|
855
839
|
{
|
856
840
|
Trace out(_instance->initializationData().logger, _instance->traceLevels()->threadPoolCat);
|
@@ -874,13 +858,8 @@ IceInternal::ThreadPool::run(const EventHandlerThreadPtr& thread)
|
|
874
858
|
|
875
859
|
try
|
876
860
|
{
|
877
|
-
#ifdef ICE_OS_UWP
|
878
|
-
current._handler = ICE_GET_SHARED_FROM_THIS(_selector.getNextHandler(current.operation, _serverIdleTime));
|
879
|
-
#else
|
880
|
-
|
881
861
|
current._handler = ICE_GET_SHARED_FROM_THIS(_selector.getNextHandler(current.operation, current._count,
|
882
862
|
current._error, _serverIdleTime));
|
883
|
-
#endif
|
884
863
|
}
|
885
864
|
catch(const SelectorTimeoutException&)
|
886
865
|
{
|
@@ -912,19 +891,6 @@ IceInternal::ThreadPool::run(const EventHandlerThreadPtr& thread)
|
|
912
891
|
Error out(_instance->initializationData().logger);
|
913
892
|
out << "exception in `" << _prefix << "':\n" << ex << "\nevent handler: " << current._handler->toString();
|
914
893
|
}
|
915
|
-
#ifdef ICE_OS_UWP
|
916
|
-
catch(Platform::Exception^ ex)
|
917
|
-
{
|
918
|
-
//
|
919
|
-
// We don't need to pass the wide string converter in the call to wstringToString
|
920
|
-
// because the wide string is using the platform default encoding.
|
921
|
-
//
|
922
|
-
Error out(_instance->initializationData().logger);
|
923
|
-
out << "exception in `" << _prefix << "':\n"
|
924
|
-
<< wstringToString(ex->Message->Data(), _instance->getStringConverter())
|
925
|
-
<< "\nevent handler: " << current._handler->toString();
|
926
|
-
}
|
927
|
-
#endif
|
928
894
|
catch(...)
|
929
895
|
{
|
930
896
|
Error out(_instance->initializationData().logger);
|
@@ -956,7 +922,7 @@ IceInternal::ThreadPool::ioCompleted(ThreadPoolCurrent& current)
|
|
956
922
|
if(_sizeMax > 1)
|
957
923
|
{
|
958
924
|
|
959
|
-
#if !defined(ICE_USE_IOCP)
|
925
|
+
#if !defined(ICE_USE_IOCP)
|
960
926
|
--_inUseIO;
|
961
927
|
|
962
928
|
if(!_destroyed)
|
@@ -1026,7 +992,7 @@ IceInternal::ThreadPool::ioCompleted(ThreadPoolCurrent& current)
|
|
1026
992
|
return _serialize && current._handler.get() != _workQueue.get();
|
1027
993
|
}
|
1028
994
|
|
1029
|
-
#if defined(ICE_USE_IOCP)
|
995
|
+
#if defined(ICE_USE_IOCP)
|
1030
996
|
bool
|
1031
997
|
IceInternal::ThreadPool::startMessage(ThreadPoolCurrent& current)
|
1032
998
|
{
|
@@ -1038,11 +1004,9 @@ IceInternal::ThreadPool::startMessage(ThreadPoolCurrent& current)
|
|
1038
1004
|
current._handler->_completed = static_cast<SocketOperation>(current._handler->_completed | current.operation);
|
1039
1005
|
current._handler->_started = static_cast<SocketOperation>(current._handler->_started & ~current.operation);
|
1040
1006
|
|
1041
|
-
#ifndef ICE_OS_UWP
|
1042
1007
|
AsyncInfo* info = current._handler->getNativeInfo()->getAsyncInfo(current.operation);
|
1043
1008
|
info->count = current._count;
|
1044
1009
|
info->error = current._error;
|
1045
|
-
#endif
|
1046
1010
|
|
1047
1011
|
if(!current._handler->finishAsync(current.operation)) // Returns false if the handler is finished.
|
1048
1012
|
{
|
@@ -1321,7 +1285,7 @@ ThreadPoolCurrent::ThreadPoolCurrent(const InstancePtr& instance,
|
|
1321
1285
|
_threadPool(threadPool.get()),
|
1322
1286
|
_thread(thread),
|
1323
1287
|
_ioCompleted(false)
|
1324
|
-
#if !defined(ICE_USE_IOCP)
|
1288
|
+
#if !defined(ICE_USE_IOCP)
|
1325
1289
|
, _leader(false)
|
1326
1290
|
#endif
|
1327
1291
|
{
|
@@ -120,7 +120,7 @@ private:
|
|
120
120
|
|
121
121
|
bool ioCompleted(ThreadPoolCurrent&);
|
122
122
|
|
123
|
-
#if defined(ICE_USE_IOCP)
|
123
|
+
#if defined(ICE_USE_IOCP)
|
124
124
|
bool startMessage(ThreadPoolCurrent&);
|
125
125
|
void finishMessage(ThreadPoolCurrent&);
|
126
126
|
#else
|
@@ -163,7 +163,7 @@ private:
|
|
163
163
|
|
164
164
|
std::set<EventHandlerThreadPtr> _threads; // All threads, running or not.
|
165
165
|
int _inUse; // Number of threads that are currently in use.
|
166
|
-
#if !defined(ICE_USE_IOCP)
|
166
|
+
#if !defined(ICE_USE_IOCP)
|
167
167
|
int _inUseIO; // Number of threads that are currently performing IO.
|
168
168
|
std::vector<std::pair<EventHandler*, SocketOperation> > _handlers;
|
169
169
|
std::vector<std::pair<EventHandler*, SocketOperation> >::const_iterator _nextHandler;
|
@@ -186,7 +186,7 @@ public:
|
|
186
186
|
return _threadPool->ioCompleted(const_cast<ThreadPoolCurrent&>(*this));
|
187
187
|
}
|
188
188
|
|
189
|
-
#if defined(ICE_USE_IOCP)
|
189
|
+
#if defined(ICE_USE_IOCP)
|
190
190
|
bool startMessage()
|
191
191
|
{
|
192
192
|
return _threadPool->startMessage(const_cast<ThreadPoolCurrent&>(*this));
|
@@ -214,7 +214,7 @@ private:
|
|
214
214
|
ThreadPool::EventHandlerThreadPtr _thread;
|
215
215
|
EventHandlerPtr _handler;
|
216
216
|
bool _ioCompleted;
|
217
|
-
#if !defined(ICE_USE_IOCP)
|
217
|
+
#if !defined(ICE_USE_IOCP)
|
218
218
|
bool _leader;
|
219
219
|
#else
|
220
220
|
DWORD _count;
|
@@ -232,7 +232,7 @@ public:
|
|
232
232
|
void destroy();
|
233
233
|
void queue(const ThreadPoolWorkItemPtr&);
|
234
234
|
|
235
|
-
#if defined(ICE_USE_IOCP)
|
235
|
+
#if defined(ICE_USE_IOCP)
|
236
236
|
bool startAsync(SocketOperation);
|
237
237
|
bool finishAsync(SocketOperation);
|
238
238
|
#endif
|
@@ -259,7 +259,7 @@ private:
|
|
259
259
|
// the IOCP implementation and ensures that finishMessage isn't called multiple
|
260
260
|
// times.
|
261
261
|
//
|
262
|
-
#if !defined(ICE_USE_IOCP)
|
262
|
+
#if !defined(ICE_USE_IOCP)
|
263
263
|
template<class T> class ThreadPoolMessage
|
264
264
|
{
|
265
265
|
public:
|
@@ -29,7 +29,7 @@ public:
|
|
29
29
|
virtual EndpointIPtr bind();
|
30
30
|
virtual SocketOperation write(Buffer&) = 0;
|
31
31
|
virtual SocketOperation read(Buffer&) = 0;
|
32
|
-
#if defined(ICE_USE_IOCP)
|
32
|
+
#if defined(ICE_USE_IOCP)
|
33
33
|
virtual bool startWrite(Buffer&) = 0;
|
34
34
|
virtual void finishWrite(Buffer&) = 0;
|
35
35
|
virtual void startRead(Buffer&) = 0;
|
@@ -119,16 +119,11 @@ IceInternal::UdpConnector::UdpConnector(const ProtocolInstancePtr& instance, con
|
|
119
119
|
const std::string& connectionId) :
|
120
120
|
_instance(instance),
|
121
121
|
_addr(addr),
|
122
|
-
#ifndef ICE_OS_UWP
|
123
122
|
_sourceAddr(sourceAddr),
|
124
|
-
#endif
|
125
123
|
_mcastInterface(mcastInterface),
|
126
124
|
_mcastTtl(mcastTtl),
|
127
125
|
_connectionId(connectionId)
|
128
126
|
{
|
129
|
-
#ifdef ICE_OS_UWP
|
130
|
-
UNREFERENCED_PARAMETER(sourceAddr);
|
131
|
-
#endif
|
132
127
|
}
|
133
128
|
|
134
129
|
IceInternal::UdpConnector::~UdpConnector()
|