[Top][All Lists]

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

Re: Can we go GTK-only?

From: YAMAMOTO Mitsuharu
Subject: Re: Can we go GTK-only?
Date: Wed, 02 Nov 2016 14:00:49 +0900
User-agent: Wanderlust/2.14.0 (Africa) SEMI/1.14.6 (Maruoka) FLIM/1.14.8 (Shij┼Ź) APEL/10.6 Emacs/22.3 (sparc-sun-solaris2.8) MULE/5.0 (SAKAKI)

>>>>> On Tue, 01 Nov 2016 22:42:27 +0200, Eli Zaretskii <address@hidden> said:

>> Emacs today can tolerate arbitrary memory allocations off the main
>> thread after dumping using the system heap. I know this to be case
>> because Emacs today, on the most common platforms --- OS X,
>> GNU/Linux, and Windows, all perform allocations off the main thread
>> in very common configurations _already_.

> The only platform I know about that starts non-main threads which
> run Emacs application code is MS-Windows, and there we don't
> allocate anything off the heap, at least not off the same heap that
> is used by the main (Lisp) thread.

The font backend driver macfont.m imported from the Mac port does
deallocation off the main thread for some data that were allocated in
the main thread.

  1489                dispatch_group_async (group, queue, ^{
  1490                    int nkeys;
  1491                    uintptr_t key;
  1492                    nkeys = nkeys_or_perm;
  1493                    for (key = row * (256 / NGLYPHS_IN_VALUE); ; key++)
  1494                      if (CFDictionaryContainsKey (dictionary,
  1495                                                   (const void *) key))
  1496                        {
  1497                          CFDictionaryRemoveValue (dictionary,
  1498                                                   (const void *) key);
  1499                          if (--nkeys == 0)
  1500                            break;
  1501                        }
  1502                  });

I can disable this for NS if it does not fit with the current policy
of GNU Emacs mainline source code.
(You can find more use cases of threads via libdispatch in the Mac
port.  Even basic drawings are done off the main thread.)

Of course, external libraries would do memory allocation/deallocation
across the threads behind the scenes.

                                     YAMAMOTO Mitsuharu

reply via email to

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