Solved

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

Posted on 2004-09-24
2
3,153 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
  • 2
2 Comments
 
LVL 45

Assisted Solution

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

Use sleep()

Sunnycoder
0
 
LVL 45

Accepted Solution

by:
sunnycoder earned 500 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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

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

Suggested Solutions

I previously wrote an article addressing the use of UBCD4WIN and SARDU. All are great, but I have always been an advocate of SARDU. Recently it was suggested that I go back and take a look at Easy2Boot in comparison.
All of the resources available today make learning a new digital media easier than ever-- if you know where to begin. This is a clear, simple guide to a few of the basic digital art mediums and how to begin learning them on your own.
The viewer will learn how to set up a document for the web and print and the recommended PPI for printing.
Video by: Tony
This video teaches viewers how to export a project from Adobe Premiere Pro and the various file types involved.

919 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now