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
icon5.gif  Question about Threads [message #25917] Fri, 19 March 2010 18:07 Go to previous message
Reini is currently offline  Reini
Messages: 28
Registered: April 2009
Location: Berlin
Promising Member
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

 
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: Sun Apr 28 11:34:10 CEST 2024

Total time taken to generate the page: 2.04366 seconds