Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Community » Newbie corner » Question about Threads
Re: Question about Threads [message #25920 is a reply to message #25917] Fri, 19 March 2010 21:25 Go to previous messageGo to previous message
koldo is currently offline  koldo
Messages: 3361
Registered: August 2008
Senior Veteran
Reini wrote on Fri, 19 March 2010 18:07

Hello upp Team,

I am experimenting a bit with Thread programming in upp and encountered an error.
The compiler did not recognize the thread class name.

The example GUIMT runs without errors from which I took most of the code, but my application does not recognize the thread class.


class MyClass : public WithMyClassLayout<TopWindow> 
{
public:
	typedef MyClass CLASSNAME;
	MyClass();
	void StartPlay();
	
	//thread handling
	volatile Atomic terminated;
	volatile Atomic threads;	
};

typedef struct {
	MyClass *gui;
} PlayInfo;

//thread callback
void WorkerThread(PlayInfo f)
{
    while (true)
    {
		if(f.gui->terminated)
			break;
		//playfile
		
    }
	AtomicDec(f.gui->threads);
}

//Callback of button
void MyClass::StartPlay()
{
	PlayInfo f;
	f.gui = this;
	AtomicInc(threads);
	Thread().Run(callback1(WorkerThread, f));//error in this line
}


Output:
error C2228: Left of ".Run" has to be a class/struct/union
Typ is ''unknown-type''
error C3861: "Thread": Identifier was not found.


Thank you for comments and help Smile



Hello Reini

I can answer you with a 99,999% of possibilities Smile that the problem comes from you have not included in "Project/Main package configuration" the option MT (multi thread).


Best regards
IƱaki
 
Read Message icon5.gif
Read Message
Read Message icon14.gif
Read Message
Read Message
Previous Topic: new
Next Topic: Problem installing Upp under Ubuntu
Goto Forum:
  


Current Time: Mon May 13 07:55:26 CEST 2024

Total time taken to generate the page: 0.01818 seconds