本文整理汇总了C++中Mutex::Signal方法的典型用法代码示例。如果您正苦于以下问题:C++ Mutex::Signal方法的具体用法?C++ Mutex::Signal怎么用?C++ Mutex::Signal使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mutex
的用法示例。
在下文中一共展示了Mutex::Signal方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetProtocolInfoComplete
void DeviceListTI::GetProtocolInfoComplete(IAsync& aAsync)
{
if (Os::TimeInMs() > iStopTimeMs) {
return;
}
FunctorAsync callback = MakeFunctorAsync(*this, &DeviceListTI::GetProtocolInfoComplete);
iConnMgr->BeginGetProtocolInfo(callback);
Brh source;
Brh sink;
iConnMgr->EndGetProtocolInfo(aAsync, source, sink); // throws if invocation failed
iLock.Wait();
gActionCount++;
if (sink.Bytes() == 0) {
ASSERT(iExpectedSink.Bytes() == 0);
}
else {
if (iExpectedSink.Bytes() == 0) {
sink.TransferTo(iExpectedSink);
}
else {
ASSERT(sink == iExpectedSink);
}
}
iLock.Signal();
}
示例2: Push
void TestStack::Push(TChar aChar)
{
iLock.Wait();
ASSERT(iCount < kMaxStackEntries);
iStack[iCount++] = aChar;
iLock.Signal();
}
示例3: Validate
void CpDevices::Validate(std::vector<const char*>& aExpectedUdns)
{
iLock.Wait();
TBool wait = (aExpectedUdns.size() > iList.size());
iTargetCount = (TUint)aExpectedUdns.size();
iLock.Signal();
if (wait) {
try {
iSem.Wait(30 * 1000);
}
catch (Timeout&) {
Print("ERROR: Failed to detect sufficient devices\n");
}
}
if (aExpectedUdns.size() != iList.size()) {
Print("ERROR: expected %u devices, found %u\n", aExpectedUdns.size(), iList.size());
ASSERTS();
}
while (aExpectedUdns.size() > 0) {
Brn expected(aExpectedUdns[0]);
TBool found = false;
for (TUint i=0; i<iList.size(); i++) {
if (expected == iList[i]->Udn()) {
Brh friendlyName;
iList[i]->GetAttribute("Upnp.FriendlyName", friendlyName);
ASSERT(friendlyName == expected);
aExpectedUdns.erase(aExpectedUdns.begin());
found = true;
break;
}
}
ASSERT(found);
}
ASSERT(aExpectedUdns.size() == 0);
}
示例4: Receiver
void SuiteMulticast::Receiver()
{
iPortLock.Wait();
SocketUdpMulticast recv(0, Endpoint(iPort, kMulticastAddress));
iPort = recv.Port();
iPortLock.Signal();
iSender.Signal(); // signal ready to begin receiving
Bwh buf(kBufBytes);
Brn exp = iExp.Split(4);
while(1) {
recv.Receive(buf);
TUint num = *((TUint32*)buf.Ptr());
if(num == kQuit) {
break;
}
Brn exp2 = exp.Split(0, num);
Brn buf2 = buf.Split(4);
TEST(buf2 == exp2);
iSender.Signal();
}
iSender.Signal();
}
示例5: GetProtocolInfoComplete
void DeviceList::GetProtocolInfoComplete(IAsync& aAsync)
{
if (Os::TimeInMs(gEnv->OsCtx()) > iStopTimeMs) {
return;
}
FunctorAsync callback = MakeFunctorAsync(*this, &DeviceList::GetProtocolInfoComplete);
iConnMgr->BeginGetProtocolInfo(callback);
std::string source;
std::string sink;
iConnMgr->EndGetProtocolInfo(aAsync, source, sink); // throws if invocation failed
iLock.Wait();
gActionCount++;
if (sink.length() == 0) {
ASSERT(iExpectedSink.length() == 0);
}
else {
if (iExpectedSink.length() == 0) {
iExpectedSink.assign(sink);
}
else {
//ASSERT(sink.compare(iExpectedSink) == 0);
// can't use the above assertion. aVia Media Renderer sometimes responds with two copies of its supported protocols
}
}
iLock.Signal();
}
示例6: Added
void CpDevices::Added(CpDevice& aDevice)
{
iLock.Wait();
const Brx& udn = aDevice.Udn();
if (udn == gNameDevice1 || udn == gNameDevice1_1 || udn == gNameDevice1_2 || udn == gNameDevice2) {
iList.push_back(&aDevice);
aDevice.AddRef();
}
iLock.Signal();
}
示例7: Added
void CpDevices::Added(CpDeviceCpp& aDevice)
{
iLock.Wait();
if (iList.size() == 0 && aDevice.Udn() == iTargetUdn) {
iList.push_back(&aDevice);
aDevice.AddRef();
iAddedSem.Signal();
}
iLock.Signal();
}
示例8: LogRemove
TBool CpListenerBasic::LogRemove(const Brx& aUuid)
{
if (aUuid == SuiteAlive::gNameDevice1) {
iLock.Wait();
iTotalByeByes++;
iLock.Signal();
return true;
}
return false;
}
示例9: Pop
TBool TestStack::Pop(TChar aChar)
{
TBool matches;
iLock.Wait();
ASSERT(iCount != 0);
iCount--;
matches = (aChar==iStack[iCount]);
iLock.Signal();
return matches;
}
示例10: Clear
void CpDevices::Clear()
{
iLock.Wait();
const TUint count = (TUint)iList.size();
for (TUint i=0; i<count; i++) {
iList[i]->RemoveRef();
}
iList.clear();
iLock.Signal();
}
示例11: Added
void CpDevices::Added(CpDevice& aDevice)
{
iLock.Wait();
const Brx& udn = aDevice.Udn();
if (udn == gNameDevice1 || udn == gNameDevice1_1 || udn == gNameDevice1_2 || udn == gNameDevice2) {
iList.push_back(&aDevice);
aDevice.AddRef();
}
if ((TUint)iList.size() == iTargetCount) {
iSem.Signal();
}
iLock.Signal();
}
示例12: PrintDeviceInfo
void DeviceListLogger::PrintDeviceInfo(const char* aPrologue, const CpDevice& aDevice)
{
iLock.Wait();
Print("%s\n udn = ", aPrologue);
Print(aDevice.Udn());
Print("\n location = ");
Brh val;
aDevice.GetAttribute("Upnp.Location", val);
Print(val);
Print("\n name = ");
aDevice.GetAttribute("Upnp.FriendlyName", val);
Print(val);
Print("\n");
iLock.Signal();
}
示例13: Removed
void CpDevices::Removed(CpDevice& aDevice)
{
/* A device sends out byebye messages before alives after being enabled.
(This is required for many buggy control points which don't spot a change of location otherwise.)
Its possible that the last of these byebyes may get interleaved with the first msearch responses,
leading to a device being added, removed, then added again.
Accept that this is possible and cope with devices being removed. */
iLock.Wait();
const Brx& udn = aDevice.Udn();
for (TUint i=0; i<iList.size(); i++) {
if (iList[i]->Udn() == udn) {
iList[i]->RemoveRef();
iList.erase(iList.begin() + i);
break;
}
}
iLock.Signal();
}
示例14: Reset
void CpListenerMsearch::Reset()
{
iLock.Wait();
iTotal = 0;
iRoot = 0;
iUdn = 0;
iDevice = 0;
iService = 0;
iUdnsReceived = 0;
free(iDev1Type);
iDev1Type = NULL;
free(iDev2Type);
iDev2Type = NULL;
free(iDev21Type);
iDev21Type = NULL;
for (TUint i=0; i<iServices.size(); i++) {
free(iServices[i]);
}
iServices.clear();
iLock.Signal();
}
示例15:
void CpProxyAvOpenhomeOrgSender1C::SetPropertyMetadataChanged(Functor& aFunctor)
{
iLock.Wait();
iMetadataChanged = aFunctor;
iLock.Signal();
}