Re: ev_async race condition??

2016-05-21 Thread Marc Lehmann
On Fri, May 20, 2016 at 02:01:00PM -0500, Jose Madrigal  
wrote:
> Hi!! I'm using libev in a multithreading project and I'm debugging with
> ThreadSanitizer from clang.  The ThreadSanitizer says there is a data race
> in libev, but i'm not sure if it is a false positive.

There aren't any known data races in libev. Maybe there is one, but clang
tends to be comparatively buggy (clang historically diagnosed all kinds of
bugs in libev when there weren't any), so at the moment I tend to assume
that it's a false positive.

> I'm wake up a event loop using ev_async because belongs to another thread.
> This is not supposed cause races.

Correct.

> And then when I take a look on those files the variable that apparently
> races is "pipe_write_skipped" but in the code looks like is a
> "sig_atomic_t" type that should not be causing races.

sig_atomic_t unfortunately doesn't make any guarantees w.r.t. threads, we use
it only because there's not better portable type available and it happens to
work correctly everywhere we know.

> Is there any chances that this race condition is real or is just a false
> positive??

Unless you compiled out synchronisation primitives with ECB_NO_THREADS or
EV_NO_SMP it's probably a false positive till proven otherwise :)

> Sorry if I was not clear enough or I misspoke, english is not my strong

The interesting question is: did you run into any trouble, or is this just
about some clang warning? If the latter, then most likely you can ignore
it.

Greetings,

-- 
The choice of a   Deliantra, the free code+content MORPG
  -==- _GNU_  http://www.deliantra.net
  ==-- _   generation
  ---==---(_)__  __   __  Marc Lehmann
  --==---/ / _ \/ // /\ \/ /  schm...@schmorp.de
  -=/_/_//_/\_,_/ /_/\_\

___
libev mailing list
libev@lists.schmorp.de
http://lists.schmorp.de/mailman/listinfo/libev

ev_async race condition??

2016-05-21 Thread Jose Madrigal
Hi!! I'm using libev in a multithreading project and I'm debugging with
ThreadSanitizer from clang.  The ThreadSanitizer says there is a data race
in libev, but i'm not sure if it is a false positive.

I'm wake up a event loop using ev_async because belongs to another thread.
This is not supposed cause races.

This is the traceback that ThreadSanitizer throw:

thread 1 (perform a Write)
#0 evpipe_write - ev.c:2443
#1 ev_async_send - ev.c:4912
#2 ev::async::send() - ev++.h:801

thread 2 (perform a Read)
#0 ev_run - ev.c:3613

And then when I take a look on those files the variable that apparently
races is "pipe_write_skipped" but in the code looks like is a
"sig_atomic_t" type that should not be causing races.

Is there any chances that this race condition is real or is just a false
positive??

Sorry if I was not clear enough or I misspoke, english is not my strong
___
libev mailing list
libev@lists.schmorp.de
http://lists.schmorp.de/mailman/listinfo/libev