Ejemplo n.º 1
0
void runnable_pair_test(runnable & a, runnable & b)
{
  cerr << "Entering runnable_pair_test" << endl;
  static thread ut1, ut2;
  ut1.start(a);
  ut2.start(b);
  ut1.join();
  ut2.join();
};
Ejemplo n.º 2
0
	inline IVCamSource::~IVCamSource()
	{
		//done using it, kill the seg_service
		stopThread = true;
		if (camThread.joinable()) camThread.join();
		TerminateProcessByName(L"seg_service.exe");
	}
Ejemplo n.º 3
0
 void operator()(thread& t)
 {
   if (t.joinable())
   {
     t.join();
   }
 }
Ejemplo n.º 4
0
 void operator()(thread& t)
 {
   t.interrupt();
   if (t.joinable())
   {
     t.join();
   }
 }
Ejemplo n.º 5
0
Archivo: main.cpp Proyecto: CCJY/coliru
 ~Actor() // <------------ PATCH
 {
     execJobSync([this]()->int
     {
         d_keepWorkerRunning = false;
         return 0;
     });
     d_worker.join();
 }
Ejemplo n.º 6
0
void rng_finilize()
{
    rng_producer_done = true;
    rng_producer_thread.join();

    /* Cleanup */
    curandDestroyGenerator(gen);
    cudaFree(devData);
}
Ejemplo n.º 7
0
	void StopReceivingMessages()
	{
		if (SetEvent(stopRunning)) {
			messageThread.join();
		} else {
			cerr << "SetEvent failed: " << GetLastError() << "\n";
			messageThread.detach();
		}
	}
Ejemplo n.º 8
0
C_LINKAGE SC_API_EXPORT void unload(InterfaceTable *inTable)
{
	inputThreadRunning = false;
	uiListenThread.join();

#ifndef _WIN32
	if (d)
		XCloseDisplay(d);
#endif
}
Ejemplo n.º 9
0
	void join()
	{
		if(!thread_.joinable())
			return;

		should_stop_ = true;

		thread_.join();

	}
Ejemplo n.º 10
0
void SwitcherData::Stop()
{
	if (th.joinable()) {
		{
			lock_guard<mutex> lock(m);
			stop = true;
		}
		cv.notify_one();
		th.join();
	}
}
Ejemplo n.º 11
0
 void stop()
 {
     if(thread_.joinable())
     {
         {
             lock_guard lock{m_};
             stop_ = true;
         }
         cond_.notify_all();
         thread_.join();
     }
 }
Ejemplo n.º 12
0
void stop_log_rotation() {
  // if no log rotation active, quit.
  if (!thread_running) return;
  // join the log rotation thread.
  lock.lock();
  thread_running = false;
  cond.signal();
  lock.unlock();
  log_rotate_thread.join();
  // we will continue logging to the same location, but we will 
  // delete the symlink
  unlink(symlink_name.c_str());
}
Ejemplo n.º 13
0
void obs_module_unload(void)
{
#ifdef USE_QT_LOOP
	BrowserShutdown();
#else
	if (manager_thread.joinable()) {
		while (!QueueCEFTask([] () {CefQuitMessageLoop();}))
			os_sleep_ms(5);

		manager_thread.join();
	}
#endif

	os_event_destroy(cef_started_event);
}
JNIEXPORT jint JNICALL Java_org_iotivity_ResourceHosting_ResourceHosting_OICCoordinatorStop
(JNIEnv *env, jobject obj)
{
    jint result = 0;
    //terminate Thread
    if (ocProcessThread.joinable())
    {
        threadRun = false;
        ocProcessThread.join();
    }
    else
    {
            result = (jint)HOSTING_THREAD_ERROR;
            return result;
    }
    result = (jint)OICStopCoordinate();

    return result;
}
JNIEXPORT jint JNICALL Java_org_iotivity_ResourceHosting_ResourceHosting_ResourceHostingTerminate
(JNIEnv *env, jobject obj)
{
    if (OCStop() != OC_STACK_OK)
    {
        return (jint)OCSTACK_ERROR;
    }
    //terminate Thread
    if (ocProcessThread.joinable())
    {
        threadRun = false;
        ocProcessThread.join();
    }
    else
    {
        return (jint)HOSTING_THREAD_ERROR;
    }

    return (jint)OCSTACK_OK;
}
Ejemplo n.º 16
0
	void stop_iocp_thread()
	{
		CancelIo(hCom);
		PostQueuedCompletionStatus (hIOCP,0,KEY_STOP,0);
		io_thread.join();
	}
Ejemplo n.º 17
0
static VALUE object_test_thread(VALUE rb_self) {
	t = create_thread(rb_self);
	t.join();
}
Ejemplo n.º 18
0
 ~ScopedThread()
 { 
     t.join();
 }
Ejemplo n.º 19
0
    void Menu_Clicked()
    {
        char picked[80];
        menubar->item_pathname(picked, sizeof(picked)-1);
        string selectPath(picked);
        cout << "Selected Menu Path:    " << selectPath << endl;
        int selected = mediaType->value();
        cout << "Selected media type:    " << ((select == 0) ? "Music" : "Video") << endl;

        if(selectPath.compare("File/Save") == 0)
        {
            cout << "Menu item Save selected." << endl;
        }
        else if(selectPath.compare("File/Restore") == 0)
        {
            cout << "Menu item Restore selected." << endl;
        }
        else if(selectPath.compare("File/Exit") == 0)
        {
            cout << "Menu item Exit selected." << endl;
            if(playThread != NULL && playThread->joinable())
            {
                playThread->join();
            }
            exit(0);
        }
        else if(selectPath.compare("Media/Add") == 0)
        {
            cout << "Menu item Add selected." << endl;
            cout << "Adding media with title: " << titleInput->value()
                << ", type " << mediaType->value() << " " << endl;
            MediaDescription file(mediaType->value(), titleInput->value(), 
                    authorInput->value(), albumInput->value(), genreInput->value(),
                    filenameInput->value());
            bool addRes = false;
            addRes = (*msc).add(file.toJSONObject());
            cout << "Add " << ((addRes) ? "successful" : "unsuccessful") << endl;
        }
        else if(selectPath.compare("Media/Remove") == 0)
        {
            string title = titleInput->value();
            bool remRes = false;
            remRes = msc->remove(title);
            cout << "Remove " << ((remRes) ? "successful" : "uneuccessful") << endl;
        }
        else if(selectPath.compare("File/Refresh Tree") == 0)
        {
            //rebuild tree here
            buildTree();
        }
        else if(selectPath.compare("Media/Play") == 0)
        {
            string unameres = exec("uname");
            string pwdPath = exec("pwd");
            pwdPath = pwdPath.substr(0, pwdPath.length()-1);
            cout << "OS type is: " << unameres << " curr.dir is: " << pwdPath
                << endl;
            stringstream streamLinux;
            streamLinux << "/usr/bin/vlc " << pwdPath << "/"
                << ((mediaType->value() == 0) ? "PaperNavySwanSong.mp3" : 
                        "MachuPicchuTimeLapseVimeo.mp4");
            string aStr("Linux");
            cout << "Linux command: " << streamLinux.str() << endl;
            string argLinux(streamLinux.str());
            cmd = argLinux;
            playThread = new thread(run);

        }

    }
void Solution::endSensing(){
  first.join();
}
Ejemplo n.º 21
0
 ~Log() {
   done = true;
   t.join();
   output.close();
 }
Ejemplo n.º 22
0
void inicioHilos(){
    thread t(cronometro, 0);
    thread t2(crearVentana,0);
    t.join();
    t2.join();
}
Ejemplo n.º 23
0
void kuka::halt() {
	keepalive = false;
	comThread.join();
}
Ejemplo n.º 24
0
 ~runandjoin() {
   if (runner.joinable())
     runner.join();
 }
Ejemplo n.º 25
0
void stopAsioThread()
{
	ioService.stop();
	gAsioThread.join();
}
Ejemplo n.º 26
0
	virtual ~AsioMTImpl() {
		io_svc.stop();
		io_thread.join();
	}
Ejemplo n.º 27
0
	void ExtJoin() {
		if(!m_started || m_finished || m_cancelled) return;
		m_thread->join();
	}
Ejemplo n.º 28
0
 void join() {
     if (t.joinable())
         t.join();
 }
Ejemplo n.º 29
0
 void join()
 {
   if (runner.joinable())
     runner.join();
 }
Ejemplo n.º 30
0
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void AppLogic::stop ()
{
    sess.stop ();
    session_thread.join ();
}