The internals of this function are some pretty hairy inline assembly, differing wildly from architecture to architecture. I can't tell precisely what it's doing. But from the comments, it sure looks like they're trying hard to make it minimal(down to the instruction-level, even) and nonblocking.
Last edited by Corona688; 06-03-2010 at 07:46 PM..
I have the following code snippet's. Which one among these would be more expensive ?
#1
for (int fd = 0; fd <= 1024; ++fd)
close(fd);
#2
for (int fd = 0; fd <= 1024; fd += 8)
{
close(fd);
close(fd+1);
close(fd+2);... (6 Replies)
My intention was to build a dual boot XP Pro 64 and Ubuntu media server. I had installed the AMD64 version of Ubuntu 8.10 server and thought that I would be able to install Apache server. I need a GUI to work in. I tried to boot and install Mythbuntu 32 bit 8.10, but my machine now won't recognize... (0 Replies)
I am using Ubuntu 9.10 with Gnome 2.28.
I use the default Nautilus File Manager to view / manage files.
Is there a way to add icons or customize the icons that are above the location bar and below the menus? There is a bar that has icons for "Back" "Forward" "Parent" above the location bar. I... (6 Replies)
Gurus,
I want log in locally to my Lucid (10.04) workstation and have my code saved over the network on my samba account
At work, all developers have samba user ids and when we were running Red Hat, we went thru the following procedure to get setup.
* open a shell session to NFS server... (2 Replies)
You really should not need one third of the entire US budget to buy a pair of running shoes... even if they are name brand. What have these guys been smoking? It reminds me of the old joke...
Customer: At those prices you aren't going to sell many shoes.
Salesman: Ah, but all we need to do is... (4 Replies)
I need to re-install ubuntu on a system with ubuntu 14.04 already installed. I have the cd but can not seem to boot from it or find the installer. Is there a way to re-install from the command line or how do I do a fresh re-install? Thank you :)
---------- Post updated at 10:13 AM... (2 Replies)
Discussion started by: cmccabe
2 Replies
LEARN ABOUT CENTOS
pthread_tryjoin_np
PTHREAD_TRYJOIN_NP(3) Linux Programmer's Manual PTHREAD_TRYJOIN_NP(3)NAME
pthread_tryjoin_np, pthread_timedjoin_np - try to join with a terminated thread
SYNOPSIS
#define _GNU_SOURCE /* See feature_test_macros(7) */
#include <pthread.h>
int pthread_tryjoin_np(pthread_t thread, void **retval);
int pthread_timedjoin_np(pthread_t thread, void **retval,
const struct timespec *abstime);
Compile and link with -pthread.
DESCRIPTION
These functions operate in the same way as pthread_join(3), except for the differences described on this page.
The pthread_tryjoin_np() function performs a nonblocking join with the thread thread, returning the exit status of the thread in *retval.
If thread has not yet terminated, then instead of blocking, as is done by pthread_join(3), the call returns an error.
The pthread_timedjoin_np() function performs a join-with-timeout. If thread has not yet terminated, then the call blocks until a maximum
time, specified in abstime. If the timeout expires before thread terminates, the call returns an error. The abstime argument is a struc-
ture of the following form, specifying an absolute time measured since the Epoch (see time(2)):
struct timespec {
time_t tv_sec; /* seconds */
long tv_nsec; /* nanoseconds */
};
RETURN VALUE
On success, these functions return 0; on error, they return an error number.
ERRORS
These functions can fail with the same errors as pthread_join(3). pthread_tryjoin_np() can in addition fail with the following error:
EBUSY thread had not yet terminated at the time of the call.
pthread_timedjoin_np() can in addition fail with the following error:
ETIMEDOUT
The call timed out before thread terminated.
pthread_timedjoin_np() never returns the error EINTR.
VERSIONS
These functions first appeared in glibc in version 2.3.3.
CONFORMING TO
These functions are nonstandard GNU extensions; hence the suffix "_np" (nonportable) in the names.
EXAMPLE
The following code waits to join for up to 5 seconds:
struct timespec ts;
int s;
...
if (clock_gettime(CLOCK_REALTIME, &ts) == -1) {
/* Handle error */
}
ts.tv_sec += 5;
s = pthread_timedjoin_np(thread, NULL, &ts);
if (s != 0) {
/* Handle error */
}
SEE ALSO clock_gettime(2), pthread_exit(3), pthread_join(3), pthreads(7)COLOPHON
This page is part of release 3.53 of the Linux man-pages project. A description of the project, and information about reporting bugs, can
be found at http://www.kernel.org/doc/man-pages/.
Linux 2010-09-10 PTHREAD_TRYJOIN_NP(3)