Exemplo n.º 1
0
extern "C" void MainTask(void *pvParameters)
{
	mallocMutex.Create("Malloc");
	spiMutex.Create("SPI");
	i2cMutex.Create("I2C");
#endif
	reprap.Init();
	for (;;)
	{
		reprap.Spin();
	}
}
Exemplo n.º 2
0
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;
}
Exemplo n.º 3
0
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;
}
Exemplo n.º 4
0
void CreateUIMutex()
{
	uiMutex.Create("UIMutex");
}
Exemplo n.º 5
0
void Kore::threadsInit() {
	mutex.Create();
	//ia.Create(1);//SR_MAX_THREADS32);
}
Exemplo n.º 6
0
		Mutex_ThreadData()
			:counter(0)
		{
			TEST_ASSERT(mutex.Create(true));
		}