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 » U++ Library support » U++ MT-multithreading and servers » Threading example for U++
icon1.gif  Threading example for U++ [message #10199] Mon, 25 June 2007 00:53 Go to next message
arturbac is currently offline  arturbac
Messages: 91
Registered: May 2007
Location: Reda, Poland
Member

I wrote this specialy for U++.
If You find this usefull in examples place it there.

27.06.2007 old code deleted, new one atached below.

[Updated on: Wed, 27 June 2007 00:48]

Report message to a moderator

Re: Threading example for U++ [message #10203 is a reply to message #10199] Mon, 25 June 2007 08:47 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
	Thread().Priority(50);


Crashed at this line for apparent reason...

Mirek
Re: Threading example for U++ [message #10205 is a reply to message #10203] Mon, 25 June 2007 09:39 Go to previous messageGo to next message
arturbac is currently offline  arturbac
Messages: 91
Registered: May 2007
Location: Reda, Poland
Member

Remove the line it is not necessery for the App. On My Win it dosn't crash.

[Updated on: Mon, 25 June 2007 09:40]

Report message to a moderator

Re: Threading example for U++ [message #10206 is a reply to message #10205] Mon, 25 June 2007 10:00 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Actually, it was just ASSERT (thread has to opened), no problem in release mode.
Re: Threading example for U++ [message #10229 is a reply to message #10199] Tue, 26 June 2007 11:30 Go to previous messageGo to next message
arturbac is currently offline  arturbac
Messages: 91
Registered: May 2007
Location: Reda, Poland
Member

Maybe this one will satisfy You, it does real job.
Probaply name schould be changed from thread example to fractal explorer.

27.06.2007 old code deleted, new one atached below.

[Updated on: Wed, 27 June 2007 00:48]

Report message to a moderator

Re: Threading example for U++ [message #10230 is a reply to message #10229] Tue, 26 June 2007 11:54 Go to previous messageGo to next message
unodgs is currently offline  unodgs
Messages: 1366
Registered: November 2005
Location: Poland
Ultimate Contributor

Wow! Very good threading example!
Re: Threading example for U++ [message #10231 is a reply to message #10230] Tue, 26 June 2007 12:22 Go to previous messageGo to next message
arturbac is currently offline  arturbac
Messages: 91
Registered: May 2007
Location: Reda, Poland
Member

Thanks. Embarassed
Re: Threading example for U++ [message #10237 is a reply to message #10231] Tue, 26 June 2007 20:28 Go to previous messageGo to next message
ebojd is currently offline  ebojd
Messages: 225
Registered: January 2007
Location: USA
Experienced Member

I was not able to get it to build (multiple errors). Most likely problem is that I am running an incompatible version of UPP (currently version 2007.1 on gentoo linux)...

What version and OS did you develop and run on?

The code looks clean enough on first read that I vote this to be added as one of the distributed example (if appropriate, etc.)


EBo --
Re: Threading example for U++ [message #10238 is a reply to message #10237] Tue, 26 June 2007 20:55 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Well, I guess it will counter the efforts a bit, but I am thinking about adding it after converting it to CoWork Smile (and perhaps improving a bit too).

Mirek
Re: Threading example for U++ [message #10239 is a reply to message #10237] Tue, 26 June 2007 20:56 Go to previous messageGo to next message
arturbac is currently offline  arturbac
Messages: 91
Registered: May 2007
Location: Reda, Poland
Member

I use Current, I'm not using 2007.1 at all at the moment.
Hoever i didn't check it on BSD with gcc, and will not becouse u++ team member dont want this ex. in U++ so there is no reason.

Re: Threading example for U++ [message #10240 is a reply to message #10238] Tue, 26 June 2007 21:00 Go to previous messageGo to next message
arturbac is currently offline  arturbac
Messages: 91
Registered: May 2007
Location: Reda, Poland
Member

luzr wrote on Tue, 26 June 2007 20:55

but I am thinking about adding it after converting it to CoWork Smile



The purpose was to show How use Threads by "hand" without CoWork, in the different way, that allows programer by hand manage entire Thread use in App.

CoWorker in U++ , BackgroundWorker in NET all are good but sometimes there are more compilated program designs wich prohibit use os such High level tools.

Re: Threading example for U++ [message #10241 is a reply to message #10240] Tue, 26 June 2007 21:05 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
That is OK. OTOH, I guess we already have an example how to do MT applications (without CoWork) - GuiMT. This one would nicely fill the need of CoWork demonstration (which is IMO missing a bit more right now).

In fact, the needed change is quite minimal, about 10 lines are deleted and one added Smile

Of course, it is your code, I will not alter/add without your permision Smile
Re: Threading example for U++ [message #10242 is a reply to message #10241] Tue, 26 June 2007 21:26 Go to previous messageGo to next message
arturbac is currently offline  arturbac
Messages: 91
Registered: May 2007
Location: Reda, Poland
Member

I will think about it.

[Updated on: Tue, 26 June 2007 21:40]

Report message to a moderator

Re: Threading example for U++ [message #10243 is a reply to message #10242] Tue, 26 June 2007 22:21 Go to previous messageGo to next message
arturbac is currently offline  arturbac
Messages: 91
Registered: May 2007
Location: Reda, Poland
Member

With CoWork my Process() will put all cb into the CoWork queue so I will not known which are active at the moment, and this is traced in app.
So propably this is not convertible to CoWork without loosing some functionality.

[Updated on: Tue, 26 June 2007 22:22]

Report message to a moderator

Re: Threading example for U++ [message #10244 is a reply to message #10199] Wed, 27 June 2007 00:40 Go to previous messageGo to next message
arturbac is currently offline  arturbac
Messages: 91
Registered: May 2007
Location: Reda, Poland
Member

I bit corrected to look nicer but without CoWork.
Allow changing threads count, rows, cols, iterations shows time etc.

I think GuiMT is better candidate for CoWork.

Current src bellow.

[Updated on: Sun, 08 July 2007 01:14]

Report message to a moderator

Re: Threading example for U++ [message #10245 is a reply to message #10237] Wed, 27 June 2007 00:43 Go to previous messageGo to next message
arturbac is currently offline  arturbac
Messages: 91
Registered: May 2007
Location: Reda, Poland
Member

ebojd wrote on Tue, 26 June 2007 20:28


I was not able to get it to build (multiple errors). Most likely problem is that I am running an incompatible version of UPP (currently version 2007.1 on gentoo linux)...



Yep i checked in 2007.1 there is not Mutex (but this is no problem)
There are unresolved symbols with Semaphore and Thread classes.

in current upp there are no problems.
Re: Threading example for U++ [message #10246 is a reply to message #10244] Wed, 27 June 2007 08:21 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
arturbac wrote on Tue, 26 June 2007 18:40


I think GuiMT is better candidate for CoWork.



Well, it is not.

CoWork is intended as a tool for simple loop paralelization. There is no loop in GuiMT....
Re: Threading example for U++ [message #10247 is a reply to message #10237] Wed, 27 June 2007 08:24 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
ebojd wrote on Tue, 26 June 2007 14:28


I was not able to get it to build (multiple errors). Most likely problem is that I am running an incompatible version of UPP (currently version 2007.1 on gentoo linux)...



Sorry, MT was the focus for the next release, there is a lot of new stuff in the "current" (and Artur is using it Wink

Mirek
Re: Threading example for U++ [message #10250 is a reply to message #10199] Wed, 27 June 2007 11:16 Go to previous messageGo to next message
arturbac is currently offline  arturbac
Messages: 91
Registered: May 2007
Location: Reda, Poland
Member

Few corrections needed for WindowsXP (not needed on XP64 lol)
Re: Threading example for U++ [message #10266 is a reply to message #10199] Thu, 28 June 2007 15:47 Go to previous messageGo to previous message
arturbac is currently offline  arturbac
Messages: 91
Registered: May 2007
Location: Reda, Poland
Member

I extended application by adding possibility to process different jobs with one forking method.
So now we have Julia % Mandelbrot sets in Threads App.

[Updated on: Sun, 08 July 2007 01:14]

Report message to a moderator

Previous Topic: Non-Blocking socket example
Next Topic: typo in manual on web
Goto Forum:
  


Current Time: Thu Mar 28 15:39:07 CET 2024

Total time taken to generate the page: 0.01110 seconds