Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How do I delay threads using pthread?  (posix standard)

Posted on 2004-09-24
2
Medium Priority
?
3,331 Views
Last Modified: 2013-11-15
I'm wondering how I can delay a thread for a certain amount of time by not using the pthread_delay_np(&ts) command, since it doesnt forfill posix standard. Can I do something with pthread_cond_timedwait() and a semaphore or mutex that wont be used for another thing than just this purpose?
or is there another way? does sleep() suspends the hole process or just a thread, can it be used or is there some other command that only suspends the thread?
0
Comment
Question by:Rawer
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
2 Comments
 
LVL 45

Assisted Solution

by:sunnycoder
sunnycoder earned 2000 total points
ID: 12141395
Hi Rawer,

Use sleep()

Sunnycoder
0
 
LVL 45

Accepted Solution

by:
sunnycoder earned 2000 total points
ID: 12141402
I had faced the same problem, and sleep will only make your thread sleep not the whole process
Initially I was planning to use alarms. You can find the discussion here
http://www.experts-exchange.com/Programming/Programming_Languages/C/Q_20639147.html
0

Featured Post

New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Ever wonder what it's like to get hit by ransomware? "Tom" gives you all the dirty details first-hand – and conveys the hard lessons his company learned in the aftermath.
Are you an Exchange administrator employed with an organization? And, have you encountered a corrupt Exchange database due to which you are not able to open its EDB file. This article will explain all the steps to repair corrupt Exchange database.
This video demonstrates basic masking and how to edit the mask to reveal the desired image.
The viewer will learn how to successfully download and install the SARDU utility on Windows 7, without downloading adware.

721 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question