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


C++ Mutex::Create方法代码示例

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


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

示例1: MainTask

extern "C" void MainTask(void *pvParameters)
{
	mallocMutex.Create("Malloc");
	spiMutex.Create("SPI");
	i2cMutex.Create("I2C");
#endif
	reprap.Init();
	for (;;)
	{
		reprap.Spin();
	}
}
开发者ID:dc42,项目名称:RepRapFirmware,代码行数:12,代码来源:Tasks.cpp

示例2: createMutex

OSystem::MutexRef TizenMutexManager::createMutex() {
	Mutex *mutex = new Mutex();
	mutex->Create();

	for (int i = 0; i < MUTEX_BUFFER_SIZE; i++) {
		if (_buffer[i] == NULL) {
			_buffer[i] = mutex;
			break;
		}
	}

	return (OSystem::MutexRef) mutex;
}
开发者ID:SinSiXX,项目名称:scummvm,代码行数:13,代码来源:system.cpp

示例3: _OpMsgLoopThread

unsigned __stdcall _OpMsgLoopThread(void *pVoid) {

  OPERATIONSTRUCT os = *reinterpret_cast<POPERATIONSTRUCT>(pVoid);

  delete pVoid;

  ProgressDlg dlg;

  if (!dlg.Create(static_cast<HINSTANCE>(g_hModule),
                  MAKEINTRESOURCE(IDD_COPYMOVE),
                  NULL))
  {

    MessageBox(os.hWnd,
               _T("Failed to create dialog!"),
               _T("extFileCopy : ERROR"),
               MB_OK | MB_ICONSTOP);

    _endthreadex(1U);

    return 1U;
  }

  Mutex m;

  if (!m.Create(NULL, FALSE, _T("extFileCopy"))) {

    MessageBox(os.hWnd,
               _T("A fatal internal error has occurred.")
               _T(" Cannot continue."),
               _T("extFileCopy : ERROR"),
               MB_OK | MB_ICONSTOP);

    _endthreadex(1U);
    return 1U;
  }

  dlg.SetMutex(&m);
  dlg.Show();

  HANDLE hMoveThread = NULL;
  UINT uiCopyThread  = 0U;

  os.pMutex = &m;
  os.pDlg   = &dlg;

  hMoveThread = reinterpret_cast<HANDLE>(_beginthreadex(NULL, 0, _OpFileMoveThread, 
                                                        &os, 0, &uiCopyThread));

  if (NULL == hMoveThread) {

    MessageBox(os.hWnd,
               _T("Failed to spawn worker thread!"),
               _T("extFileCopy : ERROR"),
               MB_OK | MB_ICONSTOP);

    _endthreadex(1U);

    return 1U;
  }

  MSG msg = {0};

  while (GetMessage(&msg, NULL, 0U, 0U)) {

    TranslateMessage(&msg);
    DispatchMessage(&msg);

  }

  _endthreadex(static_cast<UINT>(msg.wParam));
  return 0U;
}
开发者ID:ryanlederman,项目名称:extfilecopy,代码行数:73,代码来源:Operation.cpp

示例4: CreateUIMutex

void CreateUIMutex()
{
	uiMutex.Create("UIMutex");
}
开发者ID:erenik,项目名称:engine,代码行数:4,代码来源:UserInterface.cpp

示例5: threadsInit

void Kore::threadsInit() {
	mutex.Create();
	//ia.Create(1);//SR_MAX_THREADS32);
}
开发者ID:J-d-H,项目名称:Kore,代码行数:4,代码来源:Thread.cpp

示例6:

		Mutex_ThreadData()
			:counter(0)
		{
			TEST_ASSERT(mutex.Create(true));
		}
开发者ID:FlyingSwan999,项目名称:Vlpp,代码行数:5,代码来源:TestThread.cpp


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