bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] Microoptimization of lib/poll.c


From: Paolo Bonzini
Subject: Re: [PATCH] Microoptimization of lib/poll.c
Date: Wed, 06 Aug 2008 13:32:30 +0200
User-agent: Thunderbird 2.0.0.16 (Macintosh/20080707)


 #ifdef _SC_OPEN_MAX
-  if (nfd > sysconf (_SC_OPEN_MAX))
+  static int sc_open_max = -1;
+
+  if (nfd < 0
+      || (nfd > sc_open_max
+          && (sc_open_max != -1
+             || nfd > (sc_open_max = sysconf (_SC_OPEN_MAX)))))

Doesn't this make poll non-reentrant?
Are there systems where assigning to an int is not atomic?

I don't think so, and gnulib's gt_TYPE_SIG_ATOMIC_T defines sig_atomic_t as int if there is none provided by the system. I can make sc_open_max a sig_atomic_t if we care about it.

Paolo




reply via email to

[Prev in Thread] Current Thread [Next in Thread]