Branch: Tag:

2018-11-01

2018-11-01 11:35:24 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Thread.Queue [Paranoia]: Attempt to work around glibc bugs.

Glibc 2.24 and earlier have a broken implementation of condition
variables (cf https://sourceware.org/bugzilla/show_bug.cgi?id=13165).

Attempt to work around the issue by having the signalling thread
release the associated mutex before signalling.

Potential fix for [Pike-140].

378: Inside #if constant(thread_create)
   buffer[w_ptr] = value;    w_ptr++;    int items = w_ptr - r_ptr; -  r_cond::broadcast(); +  // NB: The mutex MUST be released before the broadcast to work +  // around bugs in glibc 2.24 and earlier. This seems to +  // affect eg RHEL 7 (glibc 2.17). +  // cf https://sourceware.org/bugzilla/show_bug.cgi?id=13165    key=0; -  +  r_cond::broadcast();    return items;    }