public inbox for
 help / color / mirror / Atom feed
From: Michael Haubenwallner <>
Subject: Re: [ANNOUNCEMENT] cygwin 3.1.0-0.4 (TEST)
Date: Fri, 13 Sep 2019 18:39:00 -0000	[thread overview]
Message-ID: <> (raw)
In-Reply-To: <>

On 9/5/19 3:16 PM, Ken Brown wrote:
> The following packages have been uploaded to the Cygwin distribution
> as test releases:
> * cygwin-3.1.0-0.4
> * cygwin-devel-3.1.0-0.4
> * cygwin-doc-3.1.0-0.4

> - New APIs: sched_getaffinity, sched_setaffinity, pthread_getaffinity_np,
>   pthread_setaffinity_np, plus CPU_SET macros.

There's some problem with <sched.h>, seen with boost-1.71.0/,
even after tweaking their sysinfo.cpp like this to include <sched.h>:

-#if defined(OS_LINUX)
+#if defined(OS_LINUX) || defined(OS_CYGWIN)

This boils down to a test case like this that succeeds to *compile* on Linux,
although requires _GNU_SOURCE to be defined earlier to perform anything useful:

$ cat > <<'EOF'
# include <pthread.h>
# define _GNU_SOURCE
#include <sched.h>
int main()
#if defined(CPU_COUNT_S)
  ::cpu_set_t cpu_set;
  if (::sched_getaffinity(0, sizeof(cpu_set_t), &cpu_set) == 0)
      return CPU_COUNT_S(sizeof(cpu_set_t), &cpu_set);
  return 0;

Both these commands fail to compile on Cygwin with identical error:
$ g++ test.c -DLIKE_BOOST
$ g++ test.c
test.c: In function ‘main’:
test.c:10:7: warning: implicit declaration of function ‘sched_getaffinity’; did you mean ‘sched_getparam’? [-Wimplicit-function-declaration]
   if (sched_getaffinity(0, sizeof(cpu_set_t), &cpu_set) == 0)

Actually it is boost's fault to include <pthread.h> before defining _GNU_SOURCE,
but it feels like Cygwin should *not* define CPU_COUNT_S without _GNU_SOURCE.


PS: This does work as expected:
$ g++ test.c -D_GNU_SOURCE

Problem reports:
Unsubscribe info:

  reply	other threads:[~2019-09-13 14:54 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-05 13:17 Ken Brown
2019-09-13 18:39 ` Michael Haubenwallner [this message]
2019-09-13 22:14   ` Mark Geisert
2019-09-16 11:54     ` Michael Haubenwallner

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:

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

  git send-email \ \ \ \

* 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).