Issue #14807 has been updated by taca (Takahiro Kambe).


Hi,

The similar problem occurs on NetBSD 8.0_STABLE.  (And I belive it would be occur on 7.2.)

`PTHREAD_COND_INITIALIZER` is for `pthread_cond_t` not for `pthread_condattr_t`.
So, initializing `condattr_mono` (via `condattr_monotonic`) with `pthread_condattr_init()` is correct way to fix the problem as the attached patch.

Best regards.

----------------------------------------
Bug #14807: 2.6.0-preview2 segfaults on OpenBSD due to missing pthread_condattr_init call
https://bugs.ruby-lang.org/issues/14807#change-74146

* Author: jeremyevans0 (Jeremy Evans)
* Status: Open
* Priority: Normal
* Assignee: normalperson (Eric Wong)
* Target version: 
* ruby -v: ruby 2.6.0dev (2018-06-01 trunk 63545) [x86_64-openbsd]
* Backport: 2.3: DONTNEED, 2.4: DONTNEED, 2.5: DONTNEED
----------------------------------------
r63238 refactored thread_pthread.c, and where there was previously a pthread_condattr_init call to initialize the pthread_condattr_t value, it removed the call and passed the pthread_condattr_t* directly to pthread_condattr_setclock without initializing the value by calling pthread_condattr_init first.  On some operating systems that works, but it's not required to work, and it segfaults on OpenBSD because the pthread_condattr_t is not initialized.

The attached patch should fix the problem.

---Files--------------------------------
0001-Initialize-condattr_monotonic-via-pthread_condattr_i.patch (1.08 KB)


-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>