Solved

Wait for a thread to exit for limited time on linux

Posted on 2007-04-11
3
684 Views
Last Modified: 2008-02-01
Using pthread_join(), one could wait for another thread to exit. But the pthread_join does not take a time argument, so if the other thread gets stuck and doesn't exit, the pthread_join doesn't return. Is there a way to wait for a limited time, say 5 seconds? If the other thread doesn't exit, then the calling thread could continue its own journey. Thanks a lot.
0
Comment
Question by:shibai
3 Comments
 
LVL 24

Accepted Solution

by:
slyong earned 500 total points
ID: 18894958
Hi shibai,

There is a long discussion about why pthread_join() has not timeout arguement.  Essentially, the library already provides enough primitives for someone to implement a timed join on their own, so none is provided. A sample implementation is also provided.

http://www.opengroup.org/onlinepubs/000095399/xrat/xsh_chap02.html#tag_03_02_08_21
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How can print to PDF using IP address and port only? 5 303
Need bundled ATFTP tool for use with ESXi 4 90
Linux 10 107
monitor and log every file access on redhat/linux 4 121
The purpose of this article is to fix the unknown display problem in Linux Mint operating system. After installing the OS if you see Display monitor is not recognized then we can install "MESA" utilities to fix this problem or we can install additio…
The purpose of this article is to demonstrate how we can upgrade Python from version 2.7.6 to Python 2.7.10 on the Linux Mint operating system. I am using an Oracle Virtual Box where I have installed Linux Mint operating system version 17.2. Once yo…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…

813 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

10 Experts available now in Live!

Get 1:1 Help Now