Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2013-07-11 00:58:33 +0400
committerChristopher Faylor <me@cgf.cx>2013-07-11 00:58:33 +0400
commit41f9a410cc30786e7787553113610ed4c898f5c4 (patch)
tree2778f9bf1cf1d5484fd639acdc49db6aefe8516b /winsup/cygwin/thread.cc
parentb5c0f49c1393ac336cd9f0724449f28ebb0564df (diff)
* gentlsoffsets: Clean up a little.
* thread.cc (semaphore::_fixup_after_fork): Report on potential problem parameter. Make sure that currentvalue is never zero. (semaphore::init): Make cosmetic change.
Diffstat (limited to 'winsup/cygwin/thread.cc')
-rw-r--r--winsup/cygwin/thread.cc10
1 files changed, 5 insertions, 5 deletions
diff --git a/winsup/cygwin/thread.cc b/winsup/cygwin/thread.cc
index 0d5ded675..450888d91 100644
--- a/winsup/cygwin/thread.cc
+++ b/winsup/cygwin/thread.cc
@@ -3529,11 +3529,13 @@ semaphore::_fixup_after_fork ()
if (shared == PTHREAD_PROCESS_PRIVATE)
{
pthread_printf ("sem %p", this);
+ if (!currentvalue)
+ currentvalue = 1;
/* FIXME: duplicate code here and in the constructor. */
- this->win32_obj_id = ::CreateSemaphore (&sec_none_nih, currentvalue,
+ win32_obj_id = ::CreateSemaphore (&sec_none_nih, currentvalue,
INT32_MAX, NULL);
if (!win32_obj_id)
- api_fatal ("failed to create new win32 semaphore, %E");
+ api_fatal ("failed to create new win32 semaphore, currentvalue %ld, %E", currentvalue);
}
}
@@ -3557,9 +3559,7 @@ semaphore::init (sem_t *sem, int pshared, unsigned int value)
contents happen to be a valid pointer
*/
if (is_good_object (sem))
- {
- paranoid_printf ("potential attempt to reinitialise a semaphore");
- }
+ paranoid_printf ("potential attempt to reinitialise a semaphore");
if (value > SEM_VALUE_MAX)
{