Results 1 to 5 of 5

Thread: Thread.start()

  1. #1
    jomypgeorge is offline Member
    Join Date
    May 2010
    Posts
    90
    Rep Power
    0

    Default Thread.start()

    hi friends..

    i know we cannot call Thread.start() more than once on same thread object.
    but can anyone say why there is a restriction like that?

  2. #2
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,571
    Blog Entries
    7
    Rep Power
    21

    Default

    Quote Originally Posted by jomypgeorge View Post
    hi friends..

    i know we cannot call Thread.start() more than once on same thread object.
    but can anyone say why there is a restriction like that?
    That's the way it was designed; Threads are like Sockets: if a client has closed its socket the server is left with a useless socket; it can't go "Hey, accept method, use this socket again when a client wants to connect". It's more 'pure' in an OO way: suppose a Thread could be started again: it would be some sort of zombie because it had died before; it is acting as if it were another, brand new Thread. It is much easier to start a new thread (much less bookkeeping)

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  3. #3
    masijade is offline Senior Member
    Join Date
    Jun 2008
    Posts
    2,571
    Rep Power
    9

    Default

    And much less shooting and zombie-phobia chaos. ;-)

  4. #4
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,571
    Blog Entries
    7
    Rep Power
    21

    Default

    Quote Originally Posted by masijade View Post
    And much less shooting and zombie-phobia chaos. ;-)
    Yes, that too, and also less close up scenes of maggots crawling all over the place and fallen off heads and ripped off limbs and bloody intestines flying around.

    kind regards,

    Jos ;-)
    cenosillicaphobia: the fear for an empty beer glass

  5. #5
    jomypgeorge is offline Member
    Join Date
    May 2010
    Posts
    90
    Rep Power
    0

Similar Threads

  1. Replies: 1
    Last Post: 01-18-2011, 06:27 PM
  2. Procedure to start Thread?
    By greatmajestics in forum Threads and Synchronization
    Replies: 2
    Last Post: 04-23-2010, 05:05 PM
  3. Replies: 5
    Last Post: 03-20-2009, 10:04 PM
  4. My thread will not start
    By markyoung1984 in forum Threads and Synchronization
    Replies: 4
    Last Post: 10-03-2008, 06:32 PM
  5. OutOfMemoryError: Unable to Start New Native Thread
    By edwin11 in forum Advanced Java
    Replies: 0
    Last Post: 11-16-2007, 01:47 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •