Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Calling methods on a waiting thread

 
Roy Mallard
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
IF a thread is waiting on an object, and some other threads call the thread's methods, do the method calls get queued up and invoked when the thread is notified?
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24212
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Roy,

Threads don't have methods; they invoke methods. A method always runs on the Thread that calls it -- although sometimes, the calling thread has to wait for the privilege.

If a Thread is waiting on an object, that actually has no effect at all on any other threads that call any of that same object's methods.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic