Go Back   The UNIX and Linux Forums > Top Forums > Programming
.
google site



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

Reply
English Japanese Spanish French German Portuguese Italian Powered by Powered by Google
 
Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 11-03-2009
Registered User
 

Join Date: Jan 2002
Posts: 24
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; 11-03-2009 at 02:19 AM.. Reason: code tags, please...
Sponsored Links
  #2 (permalink)  
Old 11-03-2009
Perderabo's Avatar
Unix Daemon
 

Join Date: Aug 2001
Location: Ashburn, Virginia
Posts: 9,150
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.
Sponsored Links
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 Off


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 Programming 1 12-21-2008 11:22 PM
nanosleep ameya Programming 2 03-08-2005 01:24 AM



All times are GMT -4. The time now is 06:26 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-2010. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0