Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Using multiple threads  RSS feed

 
Ed Zeval
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I need to use a couple of threads to achieve the following:

Thread 1: run method A and wait for thread 2
Thread 2: run method B, notify thread 1 to continue, and wait for thread 1
Thread 1: run method C, notify thread 2 to continue, and wait for thread 2
Thread 2: run method D, notify thread 1 to continue, and finish
Thread 1: run method E and finish

How should I do that?

Thanks!!
 
Henry Wong
author
Sheriff
Posts: 22843
119
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Since you used "wait" and "notify" in your descriptions, I am assuming that you know that it can be done with the wait() and notify() methods? What have you done so far?

Henry
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!