Find the answer to your Linux question:
Results 1 to 4 of 4
the program have 3 threads , now I want the first thread sleeping ,but the other two should run normally , if I call the sleep() function ,the process sleep ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Oct 2005
    Posts
    3

    in multithread program,How to make one of the threads sleeping while the others run normally?


    the program have 3 threads , now I want the first thread sleeping ,but the other two should run normally , if I call the sleep() function ,the process sleep ,so all the threads get sleeping , Can anyone tell me how to resolve it ?

  2. #2
    Linux Newbie
    Join Date
    Oct 2004
    Posts
    158
    from pthread man pages:
    Code:
      pthread_suspend()        This function is used to temporarily stop the
                                   execution of a thread.
    
          pthread_continue(),
          pthread_resume_np()
    
               These functions cause a previously suspended thread to continue
               execution.

  3. #3
    Just Joined!
    Join Date
    Oct 2005
    Posts
    3
    thanks for your help ,
    but I cannot find the declaration of the pthread_suspend() function on my system which runs redhat linux 9.0 , is it necessary to update the pthread library to the latest version ?

  4. #4
    Linux Newbie
    Join Date
    Jul 2005
    Location
    Chd,India
    Posts
    135
    In java Thread.sleep() makes only the thread callig that function sleep
    Also i think the suspend and resume functions in java are depricated because of resuming problems

    Dont know about C 's suspend and resume
    The strong shall live and the weak will die
    In the end,only the fittest survive in this world
    - Shishio Makoto

Posting Permissions

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