about summary refs log tree commit diff
path: root/sysdeps/htl
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2020-02-09 22:44:08 +0000
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2020-02-10 01:03:54 +0000
commit5e77ec7c6e64d67f048caa5d4dd81f10fca3dffc (patch)
tree1cd030eb9cda30d4dd7cf0e7533ee4fe0c0063f0 /sysdeps/htl
parent819bb5e660bc18fe8b39c5ffd4b9b37f6e69f4cb (diff)
downloadglibc-5e77ec7c6e64d67f048caa5d4dd81f10fca3dffc.tar.gz
glibc-5e77ec7c6e64d67f048caa5d4dd81f10fca3dffc.tar.xz
glibc-5e77ec7c6e64d67f048caa5d4dd81f10fca3dffc.zip
htl: Add support for semaphore maximum value
Diffstat (limited to 'sysdeps/htl')
-rw-r--r--sysdeps/htl/sem-post.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/sysdeps/htl/sem-post.c b/sysdeps/htl/sem-post.c
index 77f297314e..2e0be8fc49 100644
--- a/sysdeps/htl/sem-post.c
+++ b/sysdeps/htl/sem-post.c
@@ -30,6 +30,13 @@ __sem_post (sem_t *sem)
   if (sem->__value > 0)
     /* Do a quick up.  */
     {
+      if (sem->__value == SEM_VALUE_MAX)
+	{
+	  __pthread_spin_unlock (&sem->__lock);
+	  errno = EOVERFLOW;
+	  return -1;
+	}
+
       assert (sem->__queue == NULL);
       sem->__value++;
       __pthread_spin_unlock (&sem->__lock);