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


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

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


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

示例1: JUCETaskCreate

void JUCETaskCreate(void (*pvTaskCode)(void * ), const signed char *pcName,
					void *pvParameters, int uxPriority, int *pxCreatedTask)
{
	tasklistmutex.enter();
	if (arrayinited != true)
	{
		for (unsigned int i = 0; i < MAX_JUCETASKS; i++)
		{
			taskArray[i] = NULL;
		}
		arrayinited = true;
	}
	unsigned int thisID = MAX_JUCETASKS;
	for (unsigned int i = 0; i < MAX_JUCETASKS; i++)
	{
		if (taskArray[i] == NULL)
		{
			thisID = i;
			break;
		}
	}
	if (thisID == MAX_JUCETASKS) return;
	JUCETask *newtask;
	String newname = (const char*) pcName;
	newtask = new JUCETask(newname);
	newtask->TaskFunction = pvTaskCode;
	newtask->parameters = pvParameters;
	newtask->iD = thisID;
	taskArray[thisID] = newtask;
	if (pxCreatedTask != NULL) *pxCreatedTask = thisID;

	newtask->startThread(uxPriority);
	tasklistmutex.exit();
}
开发者ID:JKcompute,项目名称:395_midi_controller,代码行数:34,代码来源:JUCEtask.cpp

示例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: MutexList_Del

void MutexList_Del(CriticalSection *mutexPointer)
{
	queuelistmutex.enter();
	if (mutexPointer != NULL &&
		MutexList != NULL) 
	{
		MutexList_t *temp = MutexList;
		MutexList_t *prev = NULL;
		
		while (temp != NULL)
		{
			if (temp->mutexPointer == mutexPointer)
			{
				break;
			}
			prev = temp;
			temp = temp->next;
		}
		
		if (prev == NULL) 
		{
			MutexList = temp->next;
		} else {
			prev->next = temp->next;
		}
		
		delete temp;
		queuelistmutex.exit();
	}
}
开发者ID:gillspice,项目名称:mios32,代码行数:30,代码来源:JUCEqueue.cpp

示例4: empty

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

示例5: 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

示例6: lock

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

示例7: JUCETaskResume

void JUCETaskResume(int taskID)
{
	tasklistmutex.enter();
	JUCETask *thistask;
	thistask = taskArray[taskID];
	tasklistmutex.exit();
	if (thistask != NULL) thistask->startThread();
}
开发者ID:JKcompute,项目名称:395_midi_controller,代码行数:8,代码来源:JUCEtask.cpp

示例8: 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

示例9: 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

示例10: MutexList_Add

void MutexList_Add(CriticalSection *mutexPointer, int mutexID)
{
	queuelistmutex.enter();
	MutexList_t *root = MutexList;
	MutexList_t *newentry = new MutexList_t;
	newentry->mutexID = mutexID;
	newentry->mutexPointer = mutexPointer;
	newentry->next = root;
	MutexList = newentry;
	queuelistmutex.exit();
}
开发者ID:gillspice,项目名称:mios32,代码行数:11,代码来源:JUCEqueue.cpp

示例11: 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

示例12: 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

示例13: JUCETaskSuspend

void JUCETaskSuspend(int taskID)
{
	tasklistmutex.enter();
	JUCETask *thistask;
	thistask = taskArray[taskID];
	tasklistmutex.exit();
	if (thistask != NULL) 
	{
		if (Thread::getCurrentThreadId() != thistask->getThreadId())
		{
			thistask->stopThread(5000);
		}
		
		else thistask->signalThreadShouldExit();
		
	}
	
}
开发者ID:JKcompute,项目名称:395_midi_controller,代码行数:18,代码来源:JUCEtask.cpp

示例14: MutexListList_GetID

int MutexListList_GetID(CriticalSection *mutexPointer)
{
	queuelistmutex.enter();
	MutexList_t *temp = MutexList;
	int returnID = -1;
	
	while (temp != NULL)
	{
		if (temp->mutexPointer == mutexPointer)
		{
			returnID = temp->mutexID;
			break;
		}
		
		temp = temp->next;
	}
	queuelistmutex.exit();
	
	return returnID;
}
开发者ID:gillspice,项目名称:mios32,代码行数:20,代码来源:JUCEqueue.cpp

示例15: JUCETaskResumeAll

void JUCETaskResumeAll(void)
{
	tasklistmutex.enter();
	JUCETask *thistaskArray[MAX_JUCETASKS];
	for (unsigned int i = 0; i < MAX_JUCETASKS; i++)
	{
		thistaskArray[i] = taskArray[i];		
	}
	tasklistmutex.exit();
	
	for (unsigned int i = 0; i < MAX_JUCETASKS; i++)
	{
		if (thistaskArray[i] != NULL)
		{
			thistaskArray[i]->startThread();
		}
		
	}
	
}
开发者ID:JKcompute,项目名称:395_midi_controller,代码行数:20,代码来源:JUCEtask.cpp


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