コード例 #1
0
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;
}
コード例 #2
0
ファイル: util.hpp プロジェクト: straszheim/ecto
 void join()
 {
   if (runner.joinable())
     runner.join();
 }
コード例 #3
0
ファイル: util.hpp プロジェクト: straszheim/ecto
 ~runandjoin() {
   if (runner.joinable())
     runner.join();
 }
コード例 #4
0
ファイル: MediaClient.cpp プロジェクト: jabocg/SER321-Assign5
    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);

        }

    }
コード例 #5
0
ファイル: tiobench.cpp プロジェクト: rodrigostrauss/tio
	~TioTesterSubscriber()
	{
		assert(!thread_.joinable());
	}
コード例 #6
0
 void join() {
     if (t.joinable())
         t.join();
 }