[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: nanosleep.c & winsock.h (was Re: Windows Build Broken - Feature Bran
From: |
Shaun Tancheff |
Subject: |
RE: nanosleep.c & winsock.h (was Re: Windows Build Broken - Feature Branch) |
Date: |
Thu, 13 May 2004 16:03:42 -0500 |
Why not something simple?
#include <windows.h> // Sleep() and SleepEx()
#include <stdio.h>
#include <stdlib.h>
/*
VOID Sleep(
DWORD dwMilliseconds // sleep time in milliseconds
);
DWORD SleepEx(
DWORD dwMilliseconds, // time-out interval in milliseconds
BOOL bAlertable // early completion flag
);
*/
#define sleep(x) Sleep( (x)*1000 )
#define usleep(x) Sleep( (x) )
#define nanosleep(x) Sleep( ((x)+1000)/1000 )
int main( int argc, char * argv[] )
{
fprintf( stdout, "Sleep for 1s\n" );
sleep(1);
fprintf( stdout, "Sleep for 1ms\n" );
usleep(1);
fprintf( stdout, "Sleep for 1ns\n" );
nanosleep(1);
return 0;
}
> -----Original Message-----
> From: bug-cvs-bounces+shaun.tancheff=csausa.com@gnu.org
> [mailto:bug-cvs-bounces+shaun.tancheff=csausa.com@gnu.org] On
> Behalf Of Derek Robert Price
> Sent: Thursday, May 13, 2004 3:33 PM
> To: Conrad T. Pino
> Cc: Bug CVS
> Subject: Re: nanosleep.c & winsock.h (was Re: Windows Build
> Broken - Feature Branch)
>
>
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Conrad T. Pino wrote:
>
> >Hi Derek,
> >
> >>From: Derek Robert Price
> >>
> >>Hrm. How about a declaration with no prototype in unistd.h? It'll
> >>disable MSVC's type checking for calls to select, but it might work.
> >>e.g.:
> >>
> >>int select ();
> >
> >
> >Could I get you a cup of coffee? :)
>
>
> I think I'm past that point. I just need sleep. :)
>
> >The hard issue isn't the "select" function prototype (just a
> warning).
> >
> >The hard issue is "nanosleep" needs a "struct timeval" definition in
> >order to make the "select" call and a redefinition error occurs when
> >"winsock.h" follows "unistd.h" in the same compile.
>
>
> Ah. You could try getting just declaring struct timeval in
> nanosleep.c past Jim Meyering. Probably only when the other
> headers aren't found, of course. And assuming it works. Try
> it first...
>
> Derek
>
> - --
> *8^)
>
> Email: derek@ximbiot.com
>
> Get CVS support at <http://ximbiot.com>!
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.2.1 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>
> iD8DBQFAo9tiLD1OTBfyMaQRArqbAJ9BBmuNqKhXQB8GUazTZk/sJjjsiQCgw14M
> 3Jpxv6TzASsfMIiIcFIRhjg=
> =xKhV
> -----END PGP SIGNATURE-----
>
>
>
> _______________________________________________
> Bug-cvs mailing list
> Bug-cvs@gnu.org
> http://mail.gnu.org/mailman/listinfo/bug-cvs
>
>
- RE: Windows Build Broken - Feature Branch, (continued)
- RE: Windows Build Broken - Feature Branch, Conrad T. Pino, 2004/05/12
- Re: Windows Build Broken - Feature Branch, Derek Robert Price, 2004/05/13
- RE: Windows Build Broken - Feature Branch, Conrad T. Pino, 2004/05/13
- RE: Windows Build Broken - Feature Branch, Conrad T. Pino, 2004/05/14
- Re: Windows Build Broken - Feature Branch, Derek Robert Price, 2004/05/14
- RE: Windows Build Broken - Feature Branch, Conrad T. Pino, 2004/05/14
- RE: Windows Build Broken - Feature Branch, Conrad T. Pino, 2004/05/13
- nanosleep.c & winsock.h (was Re: Windows Build Broken - Feature Branch), Derek Robert Price, 2004/05/13
- RE: nanosleep.c & winsock.h (was Re: Windows Build Broken - Feature Branch), Conrad T. Pino, 2004/05/13
- Re: nanosleep.c & winsock.h (was Re: Windows Build Broken - Feature Branch), Derek Robert Price, 2004/05/13
- RE: nanosleep.c & winsock.h (was Re: Windows Build Broken - Feature Branch),
Shaun Tancheff <=
- RE: nanosleep.c & winsock.h (was Re: Windows Build Broken - Feature Branch), Conrad T. Pino, 2004/05/13
- RE: nanosleep.c & winsock.h (was Re: Windows Build Broken - Feature Branch), Shaun Tancheff, 2004/05/13
- RE: nanosleep.c & winsock.h (was Re: Windows Build Broken - Feature Branch), Conrad T. Pino, 2004/05/13
- Re: nanosleep.c & winsock.h (was Re: Windows Build Broken - Feature Branch), Derek Robert Price, 2004/05/13
- RE: nanosleep.c & winsock.h (was Re: Windows Build Broken - Feature Branch), Conrad T. Pino, 2004/05/14
- Re: nanosleep.c & winsock.h (was Re: Windows Build Broken - Feature Branch), Derek Robert Price, 2004/05/14
- RE: nanosleep.c & winsock.h (was Re: Windows Build Broken - Feature Branch), Conrad T. Pino, 2004/05/14
- Re: nanosleep.c & winsock.h (was Re: Windows Build Broken - Feature Branch), Derek Robert Price, 2004/05/14
- RE: nanosleep.c & winsock.h (was Re: Windows Build Broken - Feature Branch), Conrad T. Pino, 2004/05/13
RE: Windows Build Broken - Feature Branch, Conrad T. Pino, 2004/05/12