PS: @tinman - I ain't preaching doc
questions about threads
tinman, I agree. It's one of those areas that gets confused due to informal/ ill-defined definitions, eg, performance, in terms of throughput, is perfectly acceptable to the one client getting serviced by a non-threaded server.
PS: @tinman - I ain't preaching doc
You must have had the pleasure of working on some pretty impressive parallel hardware no?
PS: @tinman - I ain't preaching doc
hmmm... well, i still intend to make something to get threads to share variables in some shape or fashion... but i've been really swamped at work lately, so i haven't gotten a chance to work on it at all...
i thought i'd pop in and leave a message, so people don't peg me as un-reliable
*sigh* being a sys-admin can be demanding at times... and VERY BORING at other times... too bad this week isn't a boring one...
i thought i'd pop in and leave a message, so people don't peg me as un-reliable
*sigh* being a sys-admin can be demanding at times... and VERY BORING at other times... too bad this week isn't a boring one...
--Aszid--
Making crazy people sane, starting tomorrow.
Making crazy people sane, starting tomorrow.
- tinman
- PureBasic Expert

- Posts: 1102
- Joined: Sat Apr 26, 2003 4:56 pm
- Location: Level 5 of Robot Hell
- Contact:
No, I haven't read it (don't have as much time to expand myself as I would like), but I did get quite interested in his work on Creatures. Pretty clever stuff in there.dmoc wrote:That is sad, given the topic. PS: I particularly like the "Fear Kevin" link but can't decide whether you are fan or foe. Related: have you read Steve Grand's book "Creation: life and how to make it"?
As for Kevin, I'm just jealous 8)
If you paint your butt blue and glue the hole shut you just themed your ass but lost the functionality.
(WinXPhSP3 PB5.20b14)
(WinXPhSP3 PB5.20b14)
- tinman
- PureBasic Expert

- Posts: 1102
- Joined: Sat Apr 26, 2003 4:56 pm
- Location: Level 5 of Robot Hell
- Contact:
Reading variables should be safe, but be careful with strings because it is the string buffer which is not thread safe, not just the string itself.aszid wrote:hmm... i thought of another question that i "think" i know the answer to... but i'm not sure... can reading a variable (string or otherwise) from 2 threads at the same time cause problems, or is it only writing to the variable?
The library I started has enough in it for you to be able to safely share resources between threads. And there are a couple of examples in the archive.
If you paint your butt blue and glue the hole shut you just themed your ass but lost the functionality.
(WinXPhSP3 PB5.20b14)
(WinXPhSP3 PB5.20b14)
wow, time flies when you forget about the examples you were intending to make....
anyhow, i would like some input from people concerning this snippet, it works fine on my work computer, and the threads share the string equally, but i want to have a few more people, with different OS's and configurations to test it out and see if anything weird happens....
please let me know if this crashes your computer, or if you get anything but the desired result (the desired result is: "blah bleh blah bleh.....")
thanks in advance
anyhow, i would like some input from people concerning this snippet, it works fine on my work computer, and the threads share the string equally, but i want to have a few more people, with different OS's and configurations to test it out and see if anything weird happens....
Code: Select all
Global a,b,c,text$
Procedure testme(string$)
Repeat
Repeat
If a = 0
a = 1
Repeat
Delay(1)
Until b = 1
text$+"bleh "
c = 1
EndIf
Until c = 1
a = 0
b = 0
c = 0
Delay(1)
Until Len(text$) > 500
EndProcedure
CreateThread(@testme(),"bleh")
Repeat
If a = 1 And c = 0
b = 1
Delay(1)
ElseIf a = 0 And c = 0
text$ + "blah "
Delay(1)
EndIf
Until Len(text$) > 500
Debug text$
thanks in advance
--Aszid--
Making crazy people sane, starting tomorrow.
Making crazy people sane, starting tomorrow.
Worked great here..
XP Pro + every patch known to man. P4 2.8GHz, 1 gig of RAM.
After I put this 98 box back together I'll test it on that too.
XP Pro + every patch known to man. P4 2.8GHz, 1 gig of RAM.
After I put this 98 box back together I'll test it on that too.
-Mitchell
Check out kBilling for all your billing software needs!
http://www.k-billing.com
Code Signing / Authenticode Certificates (Get rid of those Unknown Publisher warnings!)
http://codesigning.ksoftware.net
Check out kBilling for all your billing software needs!
http://www.k-billing.com
Code Signing / Authenticode Certificates (Get rid of those Unknown Publisher warnings!)
http://codesigning.ksoftware.net
well, the desired result was "blah bleh blah bleh" but way longer, the key thing i wanted to make sure of is that each thread got access equally to the variables, one thread adds a "blah" the other adds a "bleh"
so if you just got blah's then that means it didn't work right on your comp...
what os are you running?
thanks for testin it out everyone
so if you just got blah's then that means it didn't work right on your comp...
what os are you running?
thanks for testin it out everyone
--Aszid--
Making crazy people sane, starting tomorrow.
Making crazy people sane, starting tomorrow.

