[Top][All Lists]

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

Re: Can we go GTK-only?

From: Daniel Colascione
Subject: Re: Can we go GTK-only?
Date: Mon, 31 Oct 2016 14:04:54 -0700
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux)

Eli Zaretskii <address@hidden> writes:

>> From: Ken Raeburn <address@hidden>
>> Date: Mon, 31 Oct 2016 14:22:50 -0400
>> Cc: Stefan Monnier <address@hidden>,
>>  address@hidden
>> On Oct 31, 2016, at 11:54, Eli Zaretskii <address@hidden> wrote:
>> >   One problem with
>> > having too much code in separate threads is that only the main thread
>> > can call malloc/free, i.e. you cannot create/destroy objects in other
>> > threads.
>> Wow.  Is that a Windows limitation?  It’s certainly not true under POSIX 
>> threads.
> No, it's a general limitation: malloc is non-reentrant.

Reentrancy is not the same as thread safety.

Of course you can call malloc from multiple threads. Otherwise, projects
like jemalloc would be pointless. You can freely allocate and deallocate
from different threads on both POSIX and Windows systems, and there is
no need to free an object on the thread that allocated it.

>> Creating Lisp objects, that’d be another matter, unless locking is 
>> introduced to the allocator.
> If you cannot allocate Lisp objects, the scope of what you can do in
> the non-main threads is greatly diminished.  E.g., no computation
> intensive jobs that operate on buffer text can be off-loaded to other
> threads.

Allocation of lisp objects is different. _That_ isn't thread safe
right now. The easiest way to address this problem is a GIL.

reply via email to

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