Skip to content

Commit f2857af

Browse files
committed
Use unnamed POSIX semaphores on Cygwin.
Testing on CI showed that Cygwin's semctl() can fail with EAGAIN (possibly due to resource limits in cygserver that could be tuned, not examined). Switch to so-called POSIX semaphores instead, which don't seem to fail in that way (possibly due to a more direct implementation using Windows semaphore primitives instead of talking to cygserver, based on a cursory glance at the source). Other known problems still prevent PostgreSQL from running on Cygwin without random crashes, but this rarer problem was noticed while testing. Discussion: https://postgr.es/m/CA%2BhUKG%2BQ6DU4Ov9LrvUyDcF3oHS4KMRVSKmVGaeePq-kOyG9gA%40mail.gmail.com
1 parent 39cffe9 commit f2857af

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

meson.build

+1
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,7 @@ if host_system == 'aix'
211211
memset_loop_limit = 0
212212

213213
elif host_system == 'cygwin'
214+
sema_kind = 'unnamed_posix'
214215
cppflags += '-D_GNU_SOURCE'
215216
dlsuffix = '.dll'
216217
mod_link_args_fmt = ['@0@']

src/template/cygwin

+5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# src/template/cygwin
22

3+
# Prefer unnamed POSIX semaphores if available, unless user overrides choice
4+
if test x"$PREFERRED_SEMAPHORES" = x"" ; then
5+
PREFERRED_SEMAPHORES=UNNAMED_POSIX
6+
fi
7+
38
SRCH_LIB="/usr/local/lib"
49

510
# This is required for ppoll(2), and perhaps other things

0 commit comments

Comments
 (0)