[Top][All Lists]

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

Re: Concurrency via isolated process/thread

From: Ihor Radchenko
Subject: Re: Concurrency via isolated process/thread
Date: Mon, 24 Jul 2023 08:42:52 +0000

Ihor Radchenko <yantar92@posteo.net> writes:

> 3. Current buffer, point position, and narrowing.
>    By current design, Emacs always have a single global current buffer,
>    current point position, and narrowing state in that buffer.
>    Even when we switch cooperative threads, a thread must update its
>    thread->current_buffer to previous_thread->current_buffer; and update
>    point and narrowing by calling set_buffer_internal_2.
>    Current design is incompatible with async threads - they must be able
>    to have different buffers, points, and narrowing states current
>    within each thread.
>    That's why I suggested to convert PT, BEGV, and ZV into
>    thread-locals.

Would it be acceptable to convert buffer PT, BEGV, and ZV into
thread-local for current cooperative threads?

I am thinking about:

1. Removing pt, pt_byte, begv, begv_byte, zv, zv_byte, pt_marker_,
   begv_marker_, and zv_marker_ from buffer objects.
2. Adding pt/begv/zv to thread object.
3. Adding an alist linking buffers and past
   pt/begv/zv positions visited by a given thread.

This way, when a thread yields and later continues executing, its point
and restriction will not be changed.

Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>

reply via email to

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