Sponsored Content
Top Forums Programming using usleep in c++ on diff platforms Post 47823 by shetlandbob on Thursday 19th of February 2004 11:12:01 AM
Old 02-19-2004
Thanks for the help, I found what the problem was and for any future reference I have described it below:

In my header file I have a section the "ifdef OSF Platform" then add in extra defines that are not required on the sun platform. In this section I had to add in the line:

#define _XOPEN_SOURCE_EXTENDED

The result of this was that when the routine was called and accessed the unistd.h library file it activated the usleep routine (Which wasn't being activated before). Hence when I run the code it now sleeps as its supposed to!
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

diff 2 files; output diff's to 3rd file

Hello, I want to compare two files. All records in file 2 that are not in file 1 should be output to file 3. For example: file 1 123 1234 123456 file 2 123 2345 23456 file 3 should have 2345 23456 I have looked at diff, bdiff, cmp, comm, diff3 without any luck! (2 Replies)
Discussion started by: blt123
2 Replies

2. Programming

Makefile across platforms

EXE=auto SRCS=auto.cpp debug.cpp OBJS=auto.o debug.o CXX=g++ #HOSTFLAG=-DLinux HOSTFLAG=-DSunOS # Do not use compiler optimizer -O as this may break the program # Use debug flag to enable the debug() function. If DEBUG is not # defined than the function debug() is set to void(),... (1 Reply)
Discussion started by: laila63
1 Replies

3. UNIX for Dummies Questions & Answers

what do one mean when referring to 'platforms'?

what do one mean when referring to 'platforms'? (examples of platforms as listed below) alpha amd64 i386 ia64 pc98 sparc64 Thanks! (1 Reply)
Discussion started by: ninelives1980
1 Replies

4. UNIX for Dummies Questions & Answers

zipping across platforms

I saw a few posts on this, however, I am getting an error and don't see this particular issue. Not right off anyways.... We moved from digital OS to solaris 9 in Jan. On the old platform, I could gzip my files, ftp them to my win2000 desktop via hummingbird and then unzip them to view. Now,... (8 Replies)
Discussion started by: MizzGail
8 Replies

5. Shell Programming and Scripting

Simulate SVN diff using plain diff

Hi, svn diff does not work very well with 2 local folders, so I am trying to do this diff using diff locally. since there's a bunch of meta files in an svn directory, I want to do a diff that excludes everything EXCEPT *.java files. there seems to be only an --exclude option, so I'm not sure... (3 Replies)
Discussion started by: ackbarr
3 Replies

6. Solaris

usleep command is not available in SunOS

Hi All, I need usleep command to use in one of my shell script. I am working on SunOS 5.9. Where usleep command is not available. Is there any way to use usleep command in SunOS. Thanks In Advance, chidhu (5 Replies)
Discussion started by: pa.chidhambaram
5 Replies

7. UNIX and Linux Applications

Platforms using Unix

Hi ;) Which hardware platforms/machine types use the Operating System Unix? A list of all would be appreaciated Thx Megadrink :cool: (2 Replies)
Discussion started by: Megadrink
2 Replies

8. Shell Programming and Scripting

.procmailrc and uudeview (put attachments from diff senders to diff folders)

Moderator, please, delete this topic (1 Reply)
Discussion started by: optik77
1 Replies

9. Shell Programming and Scripting

serach diff filename in diff location using shell scripting

Hi, I am new to shell scripting. please help me to find out the solution. I need a script where we need to read the text file(consists of all file names) and get the file names one by one and append the date suffix for each file name as 'yyyymmdd' . Then search each file if exists... (1 Reply)
Discussion started by: Lucky123
1 Replies

10. Shell Programming and Scripting

Diff 3 files, but diff only their 2nd column

Guys i have 3 files, but i want to compare and diff only the 2nd column path=`/home/whois/doms` for i in `cat domain.tx` do whois $i| sed -n '/Registry Registrant ID:/,/Registrant Email:/p' > $path/$i.registrant whois $i| sed -n '/Registry Admin ID:/,/Admin Email:/p' > $path/$i.admin... (10 Replies)
Discussion started by: kenshinhimura
10 Replies
USLEEP(3)						     Linux Programmer's Manual							 USLEEP(3)

NAME
usleep - suspend execution for microsecond intervals SYNOPSIS
#include <unistd.h> int usleep(useconds_t usec); Feature Test Macro Requirements for glibc (see feature_test_macros(7)): usleep(): Since glibc 2.12: _BSD_SOURCE || (_XOPEN_SOURCE >= 500 || _XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED) && !(_POSIX_C_SOURCE >= 200809L || _XOPEN_SOURCE >= 700) Before glibc 2.12: _BSD_SOURCE || _XOPEN_SOURCE >= 500 || _XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED DESCRIPTION
The usleep() function suspends execution of the calling thread for (at least) usec microseconds. The sleep may be lengthened slightly by any system activity or by the time spent processing the call or by the granularity of system timers. RETURN VALUE
0 on success, -1 on error. ERRORS
EINTR Interrupted by a signal; see signal(7). EINVAL usec is not smaller than 1000000. (On systems where that is considered an error.) CONFORMING TO
4.3BSD, POSIX.1-2001. POSIX.1-2001 declares this function obsolete; use nanosleep(2) instead. POSIX.1-2008 removes the specification of usleep(). On the original BSD implementation, and in glibc before version 2.2.2, the return type of this function is void. The POSIX version returns int, and this is also the prototype used since glibc 2.2.2. Only the EINVAL error return is documented by SUSv2 and POSIX.1-2001. NOTES
The type useconds_t is an unsigned integer type capable of holding integers in the range [0,1000000]. Programs will be more portable if they never mention this type explicitly. Use #include <unistd.h> ... unsigned int usecs; ... usleep(usecs); The interaction of this function with the SIGALRM signal, and with other timer functions such as alarm(2), sleep(3), nanosleep(2), setitimer(2), timer_create(2), timer_delete(2), timer_getoverrun(2), timer_gettime(2), timer_settime(2), ualarm(3) is unspecified. SEE ALSO
alarm(2), getitimer(2), nanosleep(2), select(2), setitimer(2), sleep(3), ualarm(3), time(7) COLOPHON
This page is part of release 3.44 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/. 2010-12-03 USLEEP(3)
All times are GMT -4. The time now is 10:43 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy