当前位置: 首页>>代码示例>>C++>>正文


C++ CriticalSection::leave方法代码示例

本文整理汇总了C++中CriticalSection::leave方法的典型用法代码示例。如果您正苦于以下问题:C++ CriticalSection::leave方法的具体用法?C++ CriticalSection::leave怎么用?C++ CriticalSection::leave使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CriticalSection的用法示例。


在下文中一共展示了CriticalSection::leave方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: empty

 bool empty() 
 {
     c_region.enter();
     bool res = (active_buffers == 0);
     c_region.leave();
     return res;
 }
开发者ID:RogerDev,项目名称:HPCC-Platform,代码行数:7,代码来源:udpsha.hpp

示例2: registerService

int ServiceManager::registerService(waServiceFactory *service, GUID owner) {
  ASSERT(owner != INVALID_GUID);
  if (owner == INVALID_GUID) return 0;
  GUID svctype = GetServiceTypeL(service);
  cs.enter();
  if (!services.multiHaveItem(svctype, service)) {
    services.multiAddItem(svctype, service);

    ownermap.addItem(service, owner);

    GUID svcguid = service->getGuid();
    if (svcguid != INVALID_GUID) services_by_guid.addItem(svcguid, service);
  }
  cs.leave();

  service->serviceNotify(SvcNotify::ONREGISTERED);

#ifdef WASABI_COMPILE_SYSCB
  CallbackManager::issueCallback(SysCallback::SERVICE,
    SvcCallback::ONREGISTER,
    reinterpret_cast<long>(&svctype), reinterpret_cast<long>(service));
#endif

  return 1;
}
开发者ID:bizzehdee,项目名称:wasabi,代码行数:25,代码来源:svcmgr.cpp

示例3: release

int ServiceManager::release(void *svcptr) {
  if (svcptr == NULL) return 0;

  waServiceFactory *wsvc = NULL;
  cs.enter();	// note cs getting locked twice via release+unlock
  if (!lockmap.getItem(svcptr, &wsvc)) {
    cs.leave();
    DebugString("WARNING: got release with no lock record!");
    return 0;
  }
  unlock(svcptr);
  cs.leave();

  ASSERT(wsvc != NULL);
  return wsvc->releaseInterface(svcptr);
}
开发者ID:bizzehdee,项目名称:wasabi,代码行数:16,代码来源:svcmgr.cpp

示例4: sendNotification

void ServiceManager::sendNotification(int msg, int param1, int param2) {
  cs.enter();
  for (int x = 0; x < services.multiGetNumPairs(); x++) {
    for (int y = 0; ; y++) {
      waServiceFactory *svc;
      if (!services.multiGetItemDirect(x, y, &svc)) {
        break;
      }
      svc->serviceNotify(msg, param1, param2);
    }
  }
  cs.leave();
#ifdef WASABI_COMPILE_COMPONENTS
  // also notify components
  for (int i = 0; ; i++) {
    WaComponent *wac = ComponentManager::enumComponent(i);
    if (wac == NULL) break;
    wac->onNotify(WAC_NOTIFY_SERVICE_NOTIFY, msg, param1, param2);
  }
#endif
#ifdef WASABI_COMPILE_SYSCB
  // and syscallbacks
  CallbackManager::issueCallback(SysCallback::RUNLEVEL, msg);
#endif
}
开发者ID:bizzehdee,项目名称:wasabi,代码行数:25,代码来源:svcmgr.cpp

示例5: unlock

	void unlock()
	{
#ifdef DEBUG
		if (!locked) throw "Already unlocked";
#endif
		cs->leave();
		locked = false;
	}
开发者ID:CyberShadow,项目名称:DDD,代码行数:8,代码来源:sync_winapi.cpp

示例6: pop

 void pop (_et &element) 
 {
     data_avail.wait();
     c_region.enter();
     element = elements[first];
     first = (first + 1) % element_count;
     active_buffers--;
     c_region.leave();
     free_space.signal();
 }
开发者ID:RogerDev,项目名称:HPCC-Platform,代码行数:10,代码来源:udpsha.hpp

示例7: push

 void push(const _et &element)
 {
     free_space.wait();
     c_region.enter();
     int next = (last + 1) % element_count;
     elements[last] = element;
     last = next;
     active_buffers++;
     c_region.leave();
     data_avail.signal();
 }
开发者ID:RogerDev,项目名称:HPCC-Platform,代码行数:11,代码来源:udpsha.hpp

示例8: unlock

int ServiceManager::unlock(void *svcptr) {
  if (svcptr == NULL) return 0;

  waServiceFactory *wsvc = NULL;
  cs.enter();
  if (!lockmap.getItem(svcptr, &wsvc)) {
    cs.leave();
    DebugString("WARNING: got unlock with no lock record!");
    return 0;
  }

  int r = lockmap.delItem(svcptr);
  ASSERT(r);

  //CUT  // this might fail, client locking isn't enforceable
  //CUT  clientmap.delItem(svcptr);

  cs.leave();

  return 1;
}
开发者ID:bizzehdee,项目名称:wasabi,代码行数:21,代码来源:svcmgr.cpp

示例9: lock

 bool lock(SessionId owner,bool exclusive, unsigned timeout)
 {
     CTimeMon tm(timeout);
     sect.enter();
     loop {
         unsigned num = owners.ordinality();
         if (exclusive) {
             if (num==0) {
                 owners.append(owner);
                 exclusivenest = 1;
                 break;
             }
             else if (exclusivenest && (owners.item(0)==owner)) {
                 exclusivenest++;
                 break;
             }
         }
         else if (!exclusivenest) {
             owners.append(owner);
             break;
         }
         waiting++;
         sect.leave();
         unsigned remaining;
         if (tm.timedout(&remaining)||!sem.wait(remaining)) {
             sect.enter();
             if (!sem.wait(0)) {
                 waiting--;
                 sect.leave();
                 return false;
             }
         }
         else
             sect.enter();
     }
     sect.leave();
     return true;
 }
开发者ID:Josh-Googler,项目名称:HPCC-Platform,代码行数:38,代码来源:dalock.cpp

示例10: unlock

 void unlock(SessionId owner)
 {
     sect.enter();
     if (exclusivenest) {
         exclusivenest--;
         if (exclusivenest) { // still locked
             assertex(owners.item(0)==owner);
             sect.leave();
             return;
         }
     }
     verifyex(owners.zap(owner));
     if (owners.ordinality()==0) {
         exclusivenest = 0;
         if (waiting) {
             sem.signal(waiting);
             waiting = 0;
         }
     }
     else {
         assertex(!exclusivenest);
     }
     sect.leave();
 }
开发者ID:Josh-Googler,项目名称:HPCC-Platform,代码行数:24,代码来源:dalock.cpp

示例11: deregisterService

int ServiceManager::deregisterService(waServiceFactory *service, int internal) {
  GUID svctype = GetServiceTypeL(service);
  // make sure it was there
  cs.enter();
  if (services.multiHaveItem(svctype, service)) {
    // make sure there aren't still services issued by this guy
    //  ASSERT(internal || !lockmap.reverseGetItem(service));
    services.multiDelItem(svctype, service);
    ownermap.delItem(service);
    services_by_guid.reverseDelItem(service);
  }
  cs.leave();
  service->serviceNotify(SvcNotify::ONDEREGISTERED);

#ifdef WASABI_COMPILE_SYSCB
  CallbackManager::issueCallback(SysCallback::SERVICE,
    SvcCallback::ONDEREGISTER,
    reinterpret_cast<long>(&svctype), reinterpret_cast<long>(service));
#endif

  return 1;
}
开发者ID:bizzehdee,项目名称:wasabi,代码行数:22,代码来源:svcmgr.cpp

示例12: in_queue

 unsigned in_queue() {
     c_region.enter();
     unsigned res = active_buffers;
     c_region.leave();
     return res;
 }
开发者ID:RogerDev,项目名称:HPCC-Platform,代码行数:6,代码来源:udpsha.hpp


注:本文中的CriticalSection::leave方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。