public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Herbert Groot Jebbink <herbert@groot.jebbink.nl>
To: cygwin@cygwin.com
Subject: sleep removed ?
Date: Wed, 11 Jul 2012 08:59:00 -0000	[thread overview]
Message-ID: <CAEfSKhekKJUxVo1Nh08O4Xa2rkm788RX-f9HMr-a4DLz2WBtEA@mail.gmail.com> (raw)

Hi,

I was asked to make a little change in a c program from 10+ years ago.
The change itself was not the problem, but the environment is changed
and I did have compile problems.

Old: Cygwin: 1.3.2  (0.39/3/2)  2001-05-20 23:28
New: Cygwin: 1.7.15 (0.260/5/3) 2012-05-09 10:25

The problem was the sleep statement, that was not working anymore:

     /home/herbert/project/main.c:124: undefined reference to `_sleep'

Below (the relevant parts of) the old code:

    #include <unistd.h>

    /* Extra defenition for avoiding warning at compiling */
    #ifndef UNIX
        unsigned int sleep(int); /* somehow, compiler don't understand
it completely */
    #endif

    #ifdef UNIX
        sleep(1);
    #else
        sleep(1000);
    #endif

I changed it into:

    #ifdef _WIN32
    # include <windows.h>
    # define sleep(x) Sleep(1000 * x)
    #else
    # include <unistd.h>
    #endif

    sleep(1);

It compiles now, but is it also correct ?

The executable did go from 251 KB to 1034 KB, is this caused by
windows.h that is now included and not in the old version ?

Kind Regards, Herbert

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

                 reply	other threads:[~2012-07-11  8:59 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAEfSKhekKJUxVo1Nh08O4Xa2rkm788RX-f9HMr-a4DLz2WBtEA@mail.gmail.com \
    --to=herbert@groot.jebbink.nl \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).