本文整理汇总了C++中WaitObjectContainer类的典型用法代码示例。如果您正苦于以下问题:C++ WaitObjectContainer类的具体用法?C++ WaitObjectContainer怎么用?C++ WaitObjectContainer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了WaitObjectContainer类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: GetWaitObjects
void WindowsPipeSender::GetWaitObjects(WaitObjectContainer &container, CallStack const& callStack)
{
if (m_resultPending)
container.AddHandle(m_event, CallStack("WindowsPipeSender::GetWaitObjects() - result pending", &callStack));
else
container.SetNoWait(CallStack("WindowsPipeSender::GetWaitObjects() - result ready", &callStack));
}
开发者ID:ChunHungLiu,项目名称:Qt-SESAM,代码行数:7,代码来源:winpipes.cpp
示例2: GetWaitObjects
void SocketReceiver::GetWaitObjects(WaitObjectContainer &container, CallStack const& callStack)
{
if (m_resultPending)
container.AddHandle(m_event, CallStack("SocketReceiver::GetWaitObjects() - result pending", &callStack));
else if (!m_eofReceived)
container.SetNoWait(CallStack("SocketReceiver::GetWaitObjects() - result ready", &callStack));
}
开发者ID:ChunHungLiu,项目名称:Qt-SESAM,代码行数:7,代码来源:socketft.cpp
示例3: GetCurrentBufferSize
lword NonblockingSink::TimedFlush(unsigned long maxTime, size_t targetSize)
{
m_blockedBySpeedLimit = false;
size_t curBufSize = GetCurrentBufferSize();
if (curBufSize <= targetSize && (targetSize || !EofPending()))
return 0;
if (!GetMaxBytesPerSecond())
return DoFlush(maxTime, targetSize);
bool forever = (maxTime == INFINITE_TIME);
unsigned long timeToGo = maxTime;
Timer timer(Timer::MILLISECONDS, forever);
lword totalFlushed = 0;
timer.StartTimer();
while (true)
{
size_t flushSize = UnsignedMin(curBufSize - targetSize, ComputeCurrentTransceiveLimit());
if (flushSize || EofPending())
{
if (!forever) timeToGo = SaturatingSubtract(maxTime, timer.ElapsedTime());
size_t ret = (size_t)DoFlush(timeToGo, curBufSize - flushSize);
if (ret)
{
NoteTransceive(ret);
curBufSize -= ret;
totalFlushed += ret;
}
}
if (curBufSize <= targetSize && (targetSize || !EofPending()))
break;
if (!forever)
{
timeToGo = SaturatingSubtract(maxTime, timer.ElapsedTime());
if (!timeToGo)
break;
}
double waitTime = TimeToNextTransceive();
if (!forever && waitTime > timeToGo)
{
m_blockedBySpeedLimit = true;
break;
}
WaitObjectContainer container;
LimitedBandwidth::GetWaitObjects(container, CallStack("NonblockingSink::TimedFlush() - speed limit", 0));
container.Wait((unsigned long)waitTime);
}
return totalFlushed;
}
开发者ID:Jactry,项目名称:cryptopp,代码行数:57,代码来源:network.cpp
示例4: GetWaitObjects
void NetworkSource::GetWaitObjects(WaitObjectContainer &container, CallStack const& callStack)
{
if (BlockedBySpeedLimit())
LimitedBandwidth::GetWaitObjects(container, CallStack("NetworkSource::GetWaitObjects() - speed limit", &callStack));
else if (!m_outputBlocked)
{
if (m_dataBegin == m_dataEnd)
AccessReceiver().GetWaitObjects(container, CallStack("NetworkSource::GetWaitObjects() - no data", &callStack));
else
container.SetNoWait(CallStack("NetworkSource::GetWaitObjects() - have data", &callStack));
}
AttachedTransformation()->GetWaitObjects(container, CallStack("NetworkSource::GetWaitObjects() - attachment", &callStack));
}
开发者ID:Jactry,项目名称:cryptopp,代码行数:14,代码来源:network.cpp
示例5: Wait
bool Waitable::Wait(unsigned long milliseconds)
{
WaitObjectContainer container;
GetWaitObjects(container);
return container.Wait(milliseconds);
}
开发者ID:axxapp,项目名称:winxgui,代码行数:6,代码来源:wait.cpp
示例6: DoPump
size_t NonblockingSource::GeneralPump2(
lword& byteCount, bool blockingOutput,
unsigned long maxTime, bool checkDelimiter, byte delimiter)
{
m_blockedBySpeedLimit = false;
if (!GetMaxBytesPerSecond())
{
size_t ret = DoPump(byteCount, blockingOutput, maxTime, checkDelimiter, delimiter);
m_doPumpBlocked = (ret != 0);
return ret;
}
bool forever = (maxTime == INFINITE_TIME);
unsigned long timeToGo = maxTime;
Timer timer(Timer::MILLISECONDS, forever);
lword maxSize = byteCount;
byteCount = 0;
timer.StartTimer();
while (true)
{
lword curMaxSize = UnsignedMin(ComputeCurrentTransceiveLimit(), maxSize - byteCount);
if (curMaxSize || m_doPumpBlocked)
{
if (!forever) timeToGo = SaturatingSubtract(maxTime, timer.ElapsedTime());
size_t ret = DoPump(curMaxSize, blockingOutput, timeToGo, checkDelimiter, delimiter);
m_doPumpBlocked = (ret != 0);
if (curMaxSize)
{
NoteTransceive(curMaxSize);
byteCount += curMaxSize;
}
if (ret)
return ret;
}
if (maxSize != ULONG_MAX && byteCount >= maxSize)
break;
if (!forever)
{
timeToGo = SaturatingSubtract(maxTime, timer.ElapsedTime());
if (!timeToGo)
break;
}
double waitTime = TimeToNextTransceive();
if (!forever && waitTime > timeToGo)
{
m_blockedBySpeedLimit = true;
break;
}
WaitObjectContainer container;
LimitedBandwidth::GetWaitObjects(container, CallStack("NonblockingSource::GeneralPump2() - speed limit", 0));
container.Wait((unsigned long)waitTime);
}
return 0;
}
开发者ID:Jactry,项目名称:cryptopp,代码行数:63,代码来源:network.cpp
示例7: Wait
bool Waitable::Wait(unsigned long milliseconds, CallStack const& callStack)
{
WaitObjectContainer container;
GetWaitObjects(container, callStack); // reduce clutter by not adding this func to stack
return container.Wait(milliseconds);
}
开发者ID:tweimer,项目名称:miranda-ng,代码行数:6,代码来源:wait.cpp
示例8: ForwardTcpPort
void ForwardTcpPort(const char *sourcePortName, const char *destinationHost, const char *destinationPortName)
{
#ifdef SOCKETS_AVAILABLE
SocketsInitializer sockInit;
Socket sockListen, sockSource, sockDestination;
int sourcePort = Socket::PortNameToNumber(sourcePortName);
int destinationPort = Socket::PortNameToNumber(destinationPortName);
sockListen.Create();
sockListen.Bind(sourcePort);
cout << "Listing on port " << sourcePort << ".\n";
sockListen.Listen();
sockListen.Accept(sockSource);
cout << "Connection accepted on port " << sourcePort << ".\n";
sockListen.CloseSocket();
cout << "Making connection to " << destinationHost << ", port " << destinationPort << ".\n";
sockDestination.Create();
sockDestination.Connect(destinationHost, destinationPort);
cout << "Connection made to " << destinationHost << ", starting to forward.\n";
SocketSource out(sockSource, false, new SocketSink(sockDestination));
SocketSource in(sockDestination, false, new SocketSink(sockSource));
WaitObjectContainer waitObjects;
while (!(in.SourceExhausted() && out.SourceExhausted()))
{
waitObjects.Clear();
out.GetWaitObjects(waitObjects);
in.GetWaitObjects(waitObjects);
waitObjects.Wait(INFINITE_TIME);
if (!out.SourceExhausted())
{
cout << "o" << flush;
out.PumpAll2(false);
if (out.SourceExhausted())
cout << "EOF received on source socket.\n";
}
if (!in.SourceExhausted())
{
cout << "i" << flush;
in.PumpAll2(false);
if (in.SourceExhausted())
cout << "EOF received on destination socket.\n";
}
}
#else
cout << "Socket support was not enabled at compile time.\n";
exit(-1);
#endif
}
开发者ID:acat,项目名称:emule,代码行数:61,代码来源:test.cpp
注:本文中的WaitObjectContainer类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论