bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#36609: 27.0.50; Possible race-condition in threading implementation


From: Pip Cet
Subject: bug#36609: 27.0.50; Possible race-condition in threading implementation
Date: Fri, 12 Jul 2019 19:24:38 +0000

On Fri, Jul 12, 2019 at 6:34 PM Eli Zaretskii <address@hidden> wrote:
> > Sorry, I don't want to call unwind-protect there.  Call me paranoid,
> > if you want.
>
> Maybe I should explain the rationale behind that paranoia.  The main

I don't think it's paranoia, I just wasn't sure there was a good way
to avoid it.

I'm now convinced that there simply is no safe way to call select()
from two threads at once when using glib.

I think our options are hacking around it and hoping nothing breaks
(this is what the attached patch does; it releases the main context
glib lock from the wrong thread soon "after" the other thread called
select, but there's actually no way to ensure that "after" is
accurate), or rewriting things so we have a single thread that does
all the select()ing.

> reason is that you are proposing to do that inside code that can
> switch threads.  Switching threads means switching to another stack
> and also to another set of handlers.  So using the unwind-protect
> machinery in this situation is IMO asking for trouble.

Thanks for explaining.

Attachment: glib-hack.diff
Description: Source code patch


reply via email to

[Prev in Thread] Current Thread [Next in Thread]