コード例 #1
0
ファイル: ctrlbox.cpp プロジェクト: howardxu4/Wijet2
void callback(Widget w,  void  *client,  XtPointer call) {
	int i = *(int*)client;

	switch(i) {		
        case ITERNET_BROWSER:
	sprintf(cmdline, "%s -height %d -width %d file:///usr/share/doc/HTML/index.html", pnames[FIREFOX], scrnX, scrnY);
        setThread(cmdline);
	break;

//	case VIDEO_PLAYER:
//	Open();
//	break;

        case CONFIGURATION:
	sprintf(cmdline, "%s -height %d -width %d http://localhost:8888", pnames[FIREFOX], scrnX, scrnY);
        setThread(cmdline);
	break;

        case EXIT_PROGRAM:
	default:
        cleanAll();
//	printf("Exit this program and go back to banner page\n");
	tellService();
	system("sdmsg Banner");
	sleep(2);
	exit(0);
	}
}
コード例 #2
0
K3bAudioImager::K3bAudioImager( K3bAudioDoc* doc, K3bJobHandler* jh, QObject* parent, const char* name )
  : K3bThreadJob( jh, parent, name ),
    m_doc(doc)
{
  m_thread = new WorkThread(doc);
  setThread( m_thread );
}
void TestActivity::onStart (void)
{
	if (!m_started)
	{
		setThread(&m_testThread);
		m_testThread.start();
		m_started = true;
	}

	RenderActivity::onStart();
}
コード例 #4
0
ファイル: threadlist.cpp プロジェクト: albfan/kdbg
void ThreadList::slotCurrentChanged(QTreeWidgetItem* newItem)
{
    if (newItem == 0)
	return;

    ThreadEntry* te = static_cast<ThreadEntry*>(newItem);

    // change the focused thread
    if (te->hasFocus)
	return;

    emit setThread(te->id);
}
コード例 #5
0
ファイル: ctrlbox.cpp プロジェクト: howardxu4/Wijet2
void OpenFile(Widget w, XtPointer a, XtPointer b)
{
	FILE *fp;
	char *filename;
	XmString filename_sel_text, err_mess;

	// Put the name of the file to be opened in to the variable filename 
	XtVaGetValues(fileDialog, XmNtextString, &filename_sel_text, NULL);
	XmStringGetLtoR(filename_sel_text, XmSTRING_DEFAULT_CHARSET, &filename);
	XmStringFree(filename_sel_text);

	if ((fp = fopen(filename, "ro")) == NULL) { // Oh, can't read that one
		err_mess = XmStringCreateSimple("Can't open that file");
		XtVaSetValues(errorDialog, XmNmessageString, err_mess, NULL);
		XmStringFree(err_mess);
		XtManageChild(errorDialog);
	}
	else { // Ok, read it 
		char msg[80];
		struct stat stat_buf;
		off_t file_size;
		int isDir;
		fstat(fileno(fp), &stat_buf);
		file_size = stat_buf.st_size;
		isDir =  (stat_buf.st_mode & S_IFDIR);
		fclose(fp);
		XtUnmanageChild(fileDialog);

		// check file location and type dir:file to run Xine
		if (strncmp(filename, USBDIR, 4) != 0) {
			sprintf(msg, "Selected file %s must be under %s", filename, USBDIR);
			err_mess = XmStringCreateSimple(msg);
			XtVaSetValues(errorDialog, XmNmessageString, err_mess, NULL);
			XmStringFree(err_mess);
			XtManageChild(errorDialog);
		}
		else {
#if 0
                        sprintf(msg, "Selected file %s size %d is Dir %d", filename, (int)file_size, isDir);
                        err_mess = XmStringCreateSimple(msg);
                        XtVaSetValues(errorDialog, XmNmessageString, err_mess, NULL);
                        XmStringFree(err_mess);
                        XtManageChild(errorDialog);
#else
			sprintf(cmdline, "%s '%s%s' -V xxmc -f", pnames[XINEAPP], isDir?"dvd:/":" ", filename);
			setThread(cmdline);
#endif
		}
  	}
  	free(filename);
}
void TestActivity::onDestroy (void)
{
	if (m_started)
	{
		setThread(DE_NULL);
		m_testThread.stop();
		m_started = false;
	}

	RenderActivity::onDestroy();

	// Kill this process.
	print("Done, killing process");
	exit(0);
}
コード例 #7
0
        void AnimationBoot::start(Callback callback)
        {
            animationSystem_ = new Graphics::Render::AnimationSystem(
            getApplication().getEcsWorld(),
            getApplication().getEventManager().getEventQueue()
            );
            animationSystem_->registerListeners(
            getApplication().getEventManager().getListenerRegister()
            );

            std::vector<Threading::ThreadableInterface*> animThreadables;
            animThreadables.push_back(animationSystem_);

            setThread(new Threading::Thread(animThreadables, 60));
            getThread().start();
            callback();
        }
コード例 #8
0
ファイル: EventHandlers.cpp プロジェクト: mdlui/Sigil2
void EventHandlers::onSyncEv(const SglSyncEv &ev)
{
    /* Flush any outstanding ST events */
    st_comm_ev.flush();
    st_comp_ev.flush();

    if /*switching threads*/(ev.type == SyncTypeEnum::SGLPRIM_SYNC_SWAP &&
                             curr_thread_id != static_cast<TID>(ev.id))
    {
        if /*new thread*/(event_ids.find(ev.id) == event_ids.cend())
        {
            std::lock_guard<std::mutex> lock(sync_event_mutex);
            thread_creates.push_back(ev.id);
        }

        setThread(ev.id);
    }
    else
    {
        SyncType type = 0;

        switch (ev.type)
        {
        /* Convert sync type to SynchroTrace's expected value
         * From SynchroTraceSim source code:
         *
         * #define P_MUTEX_LK              1
         * #define P_MUTEX_ULK             2
         * #define P_CREATE                3
         * #define P_JOIN                  4
         * #define P_BARRIER_WT            5
         * #define P_COND_WT               6
         * #define P_COND_SG               7
         * #define P_COND_BROAD            8
         * #define P_SPIN_LK               9
         * #define P_SPIN_ULK              10
         * #define P_SEM_INIT              11
         * #define P_SEM_WAIT              12
         * #define P_SEM_POST              13
         * #define P_SEM_GETV              14
         * #define P_SEM_DEST              15
         *
         * NOTE: semaphores are not supported in SynchroTraceGen
         */

        case ::SGLPRIM_SYNC_LOCK:
            type = 1;
            break;

        case ::SGLPRIM_SYNC_UNLOCK:
            type = 2;
            break;

        case ::SGLPRIM_SYNC_CREATE:
        {
            std::lock_guard<std::mutex> lock(sync_event_mutex);
            thread_spawns.push_back(std::make_pair(curr_thread_id, ev.id));
        }

        type = 3;
        break;

        case ::SGLPRIM_SYNC_JOIN:
            type = 4;
            break;

        case ::SGLPRIM_SYNC_BARRIER:
        {
            std::lock_guard<std::mutex> lock(sync_event_mutex);

            unsigned int idx = 0;

            for (auto &pair : barrier_participants)
            {
                if (pair.first == (unsigned long)ev.id)
                {
                    break;
                }

                ++idx;
            }

            if /*no matches found*/(idx == barrier_participants.size())
            {
                barrier_participants.push_back(make_pair(ev.id, std::set<TID>({curr_thread_id})));
            }
            else
            {
                barrier_participants[idx].second.insert(curr_thread_id);
            }
        }

        type = 5;
        break;

        case ::SGLPRIM_SYNC_CONDWAIT:
            type = 6;
            break;

        case ::SGLPRIM_SYNC_CONDSIG:
            type = 7;
            break;

        case ::SGLPRIM_SYNC_CONDBROAD:
            type = 8;
            break;

        case ::SGLPRIM_SYNC_SPINLOCK:
            type = 9;
            break;

        case ::SGLPRIM_SYNC_SPINUNLOCK:
            type = 10;
            break;

        default:
            /* Ignore sync event */
            break;
        }

        if /*valid sync event*/(type > 0)
        {
            st_sync_ev.flush(type, ev.id);
        }
    }
}
コード例 #9
0
K3bDirSizeJob::K3bDirSizeJob( QObject* parent )
  : K3bThreadJob( new K3bSimpleJobHandler(), parent )
{
  d = new WorkThread;
  setThread( d );
}
コード例 #10
0
K3bAudioMaxSpeedJob::K3bAudioMaxSpeedJob( K3bAudioDoc* doc, K3bJobHandler* jh, QObject* parent, const char* name )
  : K3bThreadJob( jh, parent, name )
{
  m_thread = new WorkThread( doc );
  setThread( m_thread );
}
コード例 #11
0
K3bThreadJob::K3bThreadJob( K3bThread* thread, K3bJobHandler* jh, QObject* parent, const char* name )
  : K3bJob( jh, parent, name ),
    m_running(false)
{
  setThread(thread);
}
コード例 #12
0
ファイル: kotton_fiber.hpp プロジェクト: kaiwalya/kluster
		/**Private constructor, called form static create if required*/
		thread(userfunc & f): fiber_base(nullptr, scheduleCaller), mThread(), mCurrentFiber(nullptr) {
			fiber_base::setThread(this);
			auto first = std::make_shared<fiber_base>(this, f);
			first->setThread(this);
			mFibers.push_back(first);
		}
コード例 #13
0
MStatus inverseSkinCluster::deform(MDataBlock& data,
	MItGeometry& itGeo,
	const MMatrix& localToWorldMatrix,
	unsigned int geomIndex)
{
	MStatus status;

	MMatrix geomMatrix;
	bool updateSkinInfo;

	MDataHandle hInMesh = data.inputValue( aInMesh, &status );
	CHECK_MSTATUS_AND_RETURN_IT( status );
	MObject oInMesh = hInMesh.asMesh();
	if( oInMesh.isNull() )
		return MS::kFailure;
	MFnMesh inMesh = oInMesh;
	inMesh.getPoints( m_meshPoints );

	if( originalMeshUpdated )
	{
		itGeo.allPositions( pTaskData->basePoints );
		originalMeshUpdated = false;
	}

	MDataHandle hGeomMatrix = data.inputValue( aGeomMatrix );
	geomMatrix = hGeomMatrix.asMatrix();

	MDataHandle hUpdateWeightList = data.inputValue( aUpdateWeightList );
	updateSkinInfo = hUpdateWeightList.asBool();

	MDataHandle hEnvelop = data.inputValue( envelope );
	envelopValue = hEnvelop.asFloat();

	pTaskData->envelop = envelopValue;
	pTaskData->invEnv  = 1.0f - envelopValue;
	pTaskData->beforePoints = m_meshPoints;

	if( updateSkinInfo )
	{	
		MDataHandle hUpdateSkinInfoOutput = data.outputValue( aUpdateWeightList );
		hUpdateSkinInfoOutput.set( false );
		weightListUpdated = false;
	}

	if( logicalIndexArray.length() == 0 )
		updateLogicalIndexArray();

	MDataHandle hUpdateMatrix = data.inputValue( aUpdateMatrix );

	if( hUpdateMatrix.asBool() )
	{
		matrixAttrUpdated = false;
		matrixInfoUpdated = false;
	}

	MArrayDataHandle hArrMatrix = data.inputArrayValue( aMatrix );
	MArrayDataHandle hArrBindPreMatrix = data.inputArrayValue( aBindPreMatrix );
	updateMatrixAttribute( hArrMatrix, hArrBindPreMatrix );

	if( !matrixInfoUpdated )
	{
		updateMatrixInfo( hArrMatrix, hArrBindPreMatrix );
	}

	if( !weightListUpdated )
	{
		pTaskData->afterPoints.setLength( m_meshPoints.length() );
		pTaskData->envPoints.setLength( m_meshPoints.length() );

		updateWeightList();
	}

	if( !matrixInfoUpdated || !weightListUpdated )
	{
		if( pSkinInfo->weightsArray.size() > 0 )
			getWeightedMatrices( geomMatrix );
		else
			return MS::kFailure;

		matrixInfoUpdated = true;
		weightListUpdated = true;
	}

	if( envelopValue )
	{
		setThread();
		MThreadPool::newParallelRegion( parallelCompute, pThread );
		endThread();

		itGeo.setAllPositions( pTaskData->envPoints );
	}
	else
	{
		itGeo.setAllPositions( pTaskData->basePoints );
	}

	return MS::kSuccess;
}