"but I find that when I step though the code, it randomly skips between
threads."
you have to realize that it is part of the java specification to allow
threads to execute whenever and however they want. no part of the
contract says that one thread must execute before, during or after
another. in fact, it's technically possible for the java runtime to hold
a thread altogether until it feels it's ready to run it.
if your seeing this behaviour then the good news is, is that your jre is
working fine.
as for stepping thru a single thread, do so! as for the other threads in
the background doing there thing, this is where design comes into play.
your problems are not with the thread implementation provided by java,
it's with your need for a good thread synchronization strategy. there's
a very good book dedicated to JavaSpaces that provides plenty of cool
ways to get threads to share a resource or share a work in progress.
http://www.awprofessional.com/title/0201309556
the cool part of this is that you get to learn this and apply your own
ideas on it today!
amazon has a good book review too. but don't get side tracked into
thinking that you need JavaSpaces on top of what you are already doing.
JavaSpaces was intended to simplify a distributed application over Jini.
In your case, you'll be more interested in the design patterns.
This I think is what you are really after.
Feel free to email me directly for more on this.
- perry
pe***@cplusplus.org
Charles Fox wrote:
Thanks for your reply, however,
I don't quite get how JBuilder does this -- I have tried putting
breakpoints in parts of the code run by each thread, but I find that
when I step though the code, it randomly skips between threads. I
need to be able to step through a single thread and ignore the other
threads. Am I missing something? I've tried right-clicking the
thread icon in the 'threads,call stacks,data' window and selecting
'steppign thread' but it doesn't seem to do anything different. Are
there any instructions on the web with details of how to do this? I
can't find anything!