Page 1 of 1
Posted: Mon Apr 22, 2002 7:42 pm
by BackupUser
Restored from previous forum. Originally posted by freak.
Hi,
I think, a very useful thing to add to the Thread Library is a command to
check wether a Thread is still running or not, something like IsThread(ThreadID)
or so.
Timo
A debugged program is one for which you have not yet found the conditions that make it fail.
Posted: Fri Apr 26, 2002 9:43 pm
by BackupUser
Restored from previous forum. Originally posted by freak.
43 People read this article, but no suggestons?? Strange.
He Fred, what about implementing that in 3.10??
BTW: When will 3.10 be avaiable?
That's it...
Timo
--
A debugged program is one for which you have not yet found the conditions that make it fail.
Posted: Fri Apr 26, 2002 10:02 pm
by BackupUser
Restored from previous forum. Originally posted by Franco.
OK, OK Timo here one answer...
Well at first I thought: wow not bad... this would be nice.
But after thinking about: How would I implement it?
(keep in mind that I'm not a genius...)
I think:
it's not so easy to implement - because you can put a delay/sleep command
in your thread , and how can Fred (he is a genius...) figure out:
is the thread 'running' or 'not running' or 'sleeping by purpose'?
Have a nice day...
Franco
Sometimes you have to go a lonely way to accomplish genius things.
Edited by - franco on 26 April 2002 23:07:32
Posted: Sat Apr 27, 2002 4:36 am
by BackupUser
Restored from previous forum. Originally posted by El_Choni.
First of all, congratulations to Franco on his 400th post (clap, clap), "how do you feel about it?", "are you going for the next 400?", "don't you feel underestimated by your lonesome three red stars?", etc.
Second: I've been playing with threads, both PB's and Windows, and I always have problems due to lack of documentation (both PB and API). Dealing with API threads is complex for me. When I try to share variables between threads or between a thread and the 'worker' or 'working' thread (as they call it), everything gets messed up, or just crashes.
I hope Fred multiplies himself by ten to supply us with more deep docs and examples.
Have a nice day,
Edited by - El_Choni on 27 April 2002 13:53:14
Posted: Sat Apr 27, 2002 5:28 pm
by BackupUser
Restored from previous forum. Originally posted by PB.
> 43 People read this article, but no suggestons?? Strange.
Why strange? We can read without knowing an answer, can't we?
PB - Registered PureBasic Coder
Posted: Sat Apr 27, 2002 6:29 pm
by BackupUser
Restored from previous forum. Originally posted by tinman.
Second: I've been playing with threads, both PB's and Windows, and I always have problems due to lack of documentation (both PB and API). Dealing with API threads is complex for me. When I try to share variables between threads or between a thread and the 'worker' or 'working' thread (as they call it), everything gets messed up, or just crashes.
If you are working with threads you really need to be able to send messages between the threads and have semaphores (or be able to specify critical sections of code) for accessing your global variables between threads.
--
It's not minimalist - I'm increasing efficiency by reducing input effort.
Posted: Mon Apr 29, 2002 8:19 am
by BackupUser
Restored from previous forum. Originally posted by Stan.
I don't know if it works for threads, but using atoms may be a hack to do it ...
Stan
Since I attended an MS course, my programs no longer have bugs ... just hidden "features" !! [ PB. registered user ]
Posted: Mon Apr 29, 2002 3:44 pm
by BackupUser
Restored from previous forum. Originally posted by Franco.
When I try to share variables between threads or between a thread and the 'worker' or 'working' thread (as they call it), everything gets messed up, or just crashes.
Hi El_Choni, have you tried Single Arrays instead of variables?
I started to program a game like 'Perestroika' (from the year 1990...) and there are on the base level 28 islands (7x4), and they change from 'big' to 'small' to 'water' and the changing routine is a thread (random).
In the normal loop (not a thread) I can move the 'player' from island to island, and if he moves to an empty spot - he dies.
Anyway, nevertheless the islands are changing constantly and the 'variables' like IslandSize or PlayerPosition etc. are changing all the time and all is working well.
But the most part I use Arrays! (a bunch of constants and a little amount of variables)
Instead of a variable PlayerPosition I use PlayerPosition(0) to store a value.
Yes, you have to Dim the Array with: Dim PlayerPosition.l(0) but all these Single Arrays are available to all procedures/threads - and it works well.
OK after messing around with the code I have a Structure instead of a single long value because I have to store more information, but I hope you get the point.
Use Single Arrays instead of variables - it works for me
Don't know about the memory - suppose a Single Array uses a little bit more... - but I really want the job done, instead of wasting my spare time to save some bytes of memory.
Have a nice day...
Franco
Sometimes you have to go a lonely way to accomplish genius things.
Edited by - Franco on 30 April 2002 16:35:24
Posted: Mon Apr 29, 2002 6:27 pm
by BackupUser
Restored from previous forum. Originally posted by freak.
Well, I in my progs, I use threads to calculate or compress/decompress stuff in the backround. But the problem was, how does the main prog know, when the job is done?
Some new command might be useful here.
Another suggestion: Why not add something like #PB_EventThreadEnd to the catched Events??
This is a 'Wishlist' Forum, so this is a 'wish'. I don't say, this has to be implemented, but it might be useful.
--
A debugged program is one for which you have not yet found the conditions that make it fail.
Edited by - freak on 29 April 2002 21:22:13
Posted: Mon Apr 29, 2002 7:26 pm
by BackupUser
Restored from previous forum. Originally posted by PB.
> how does the main prog know, when the job is done?
Global variable?
PB - Registered PureBasic Coder
Posted: Mon Apr 29, 2002 7:41 pm
by BackupUser
Restored from previous forum. Originally posted by Franco.
> how does the main prog know, when the job is done?
Global variable?
YEP, this is the easiest way to do it!
As a Variable:
Global JobDone.l
or
as a Single Array
Dim JobDone.l(0)
Have a nice day...
Franco
Sometimes you have to go a lonely way to accomplish genius things.
Edited by - Franco on 30 April 2002 16:36:12
Posted: Mon Apr 29, 2002 8:28 pm
by BackupUser
Restored from previous forum. Originally posted by freak.
Well, figured that out too, so... forget about it.
--
A debugged program is one for which you have not yet found the conditions that make it fail.