1 Reply Latest reply: Nov 24, 2009 4:14 PM by 796447 RSS

    Threads waiting for each other

    807580
      Hey,
      I am developing a multi-threaded program. The thing is that I have a GUIThread and a XMLsettingsReaderThread (well among other threads).... Now it is absolutely necessary that the GUIThread is executed and completed to a certain level before the XMLsettingsReaderThread starts...Now how do I do this? The problem is that I want the GUIthread create a Frame first before XMLsettingsReaderThread starts cause it uses a getter on the Frame(created in GUIThread) and if XMLsettingsReaderThread is first then there is no frame yet so I get NullPointerException.

      thank you veeery much :)
        • 1. Re: Threads waiting for each other
          796447
          That's what the Object.wait() and Object.notify() methods are for, in conjunction with the synchronized keyword or block.
          I recommend you read the threading (concurrency) tutorial.
          [http://java.sun.com/docs/books/tutorial/essential/concurrency/index.html]