Threaded persistence?

Everything else that doesn't fall into one of the other PB categories.
Marlin
Enthusiast
Enthusiast
Posts: 406
Joined: Sun Sep 17, 2006 1:24 pm
Location: Germany

Threaded persistence?

Post by Marlin »

I just stumbled upon this new keyword "Threaded".
Help wrote:Threaded allows to create a thread based persistent variable, arrays, linkedlists or maps. That means than every thread will have its own version of the object.
As far as I understood it yet, this allows globally visible variables... with individual content for each thread.
So I could use it in procedures called by threads, without the need to put it in the parameter list.
(In contrast to variables declared in the thread procedure)
Also there is one version for the main process.

What I did not quite understand yet, is how there could be any use or availability of "persistence",
after a thread has ended.
Is this persistence only meant for the main process itself?
(where this variable... is also visible with an individual value)

Are there any other special properties to the "Threaded" approach?
freak
PureBasic Team
PureBasic Team
Posts: 5929
Joined: Fri Apr 25, 2003 5:21 pm
Location: Germany

Re: Threaded persistence?

Post by freak »

The data is destroyed once the thread ends.

"persistent" is the wrong term here because it has a special meaning in computer science ("persistent" as in "on a stable storage device") compared to its general language use.
quidquid Latine dictum sit altum videtur
Marlin
Enthusiast
Enthusiast
Posts: 406
Joined: Sun Sep 17, 2006 1:24 pm
Location: Germany

Re: Threaded persistence?

Post by Marlin »

Thank you freak.

I was assuming, there could have been meant some kind of persistence like the static keyword gives.

Maybe the word "persistent" should be deleted at that point in the help file.
(It is mentioned anyhow that those variables... do have global scope.
That makes it clear, that the version for the main process will not be lost
until the program ends.)
Post Reply