The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > High Level Programming
.
google unix.com



High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
nanosleep returns prematurely, with return value 0 MeMyself High Level Programming 1 12-21-2008 11:22 PM
nanosleep ameya High Level Programming 2 03-08-2005 01:24 AM

Reply
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 3 Weeks Ago
konvalo konvalo is offline
Registered User
  
 

Join Date: Jan 2002
Posts: 20
Where is nanosleep?

I use nanosleep under solaris10,like follows:
Code:
#include <pthread.h>
#include <time.h>
#include <sys/time.h>
struct to_info{
   void (*to_fn)(void *);
   void *to_arg;
   struct timespec to_wait;
};
void *timeout_helper(void *arg){
  struct to_info *tip;
  nanosleep(&tip->to_wait,NULL);
}
when I compile above,it raise following error:
undefined:nanosleep

Why? Which header file include nanosleep function? How to find this header file?

thanks

Last edited by pludi; 3 Weeks Ago at 02:19 AM.. Reason: code tags, please...
  #2 (permalink)  
Old 3 Weeks Ago
Perderabo's Avatar
Perderabo Perderabo is offline Forum Staff  
Unix Daemon
  
 

Join Date: Aug 2001
Location: Ashburn, Virginia
Posts: 9,111
See: nanosleep(3RT)high resolution sleep (man pages section 3: Realtime Library Functions)

You have the right header file. You also need the right library. That is why the -lrt is in bold at the top of the page.
Reply

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 02:12 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0