aspose file tools*
The moose likes Threads and Synchronization and the fly likes wait() help Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Threads and Synchronization
Bookmark "wait() help" Watch "wait() help" New topic
Author

wait() help

michael spiker
Greenhorn

Joined: Sep 11, 2006
Posts: 5
Hello all, I'm hoping you can help me, I have a class inplementing the
main() method that does the basic work (running the motors of my robot)
I have a thread that is constantly monitoring the sensors. when a sensor is activated a recovery method is called. problem is everything works great except I cannot get the main program to wait if the sensors are activated, the recovery code and the main want to run together any help would be appreciated Thanks
Purushoth Thambu
Ranch Hand

Joined: May 24, 2003
Posts: 425
If you can explain with more information about the classes it would help.
michael spiker
Greenhorn

Joined: Sep 11, 2006
Posts: 5
thanks for the reply my main class is basically just a scenario for autonomous operation (move forward,backward etc. right now it is simply a test scenario that runs thru all the capable movements)the thread simply scans the parallel port for input, and when a pin is brought low (by a bumpswitch, etc)it calls a recovery method that will in the case of the front switch, stop the bot make it reverse and go around the object blocking it.what I need to do is pause the main class while this is happening and then resume once the recovery is finished. I am learning as I go so any input would be helpful thanks
Amit A. Patil
Ranch Hand

Joined: May 04, 2006
Posts: 38
Suggest a synchronized method isRecoveryComplete..could be a shared volatile boolean variable too!
michael spiker
Greenhorn

Joined: Sep 11, 2006
Posts: 5
Thanks for the reply, but could you elaborate? I am learning java as I go
In fact I was going to post in the beginners forum, but I noticed other posts concerning threads were moved here. Thank you for your patience.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: wait() help
 
Similar Threads
Loosing sanity with SensorEventListener, please assist.
Using threads effectively
Good conversation with authors lost!!!
Error: Kernel panic: VFS: unable to mount root fs om 03:01???