[Top][All Lists]

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

Re: Concurrency via isolated process/thread

From: Po Lu
Subject: Re: Concurrency via isolated process/thread
Date: Fri, 07 Jul 2023 21:31:16 +0800
User-agent: Gnus/5.13 (Gnus v5.13)

Ihor Radchenko <yantar92@posteo.net> writes:

> Po Lu <luangruo@yahoo.com> writes:
>> Ihor Radchenko <yantar92@posteo.net> writes:
>>> Same with variables - even if some global variable needs to be locked,
>>> it is unlikely that it will need to be accessed by another thread.
>> I doubt symbol value cells will need to be individually interlocked.
>> Emacs Lisp code will need to insert the appropriate instructions to
>> prevent the CPU from undertaking optimizations on load and store
>> operations on those cells when necessary. ...
> I had a different simple scenario in mind:
> (let ((oldval case-fold-search))
>   (unwind-protect
>     (progn (setq case-fold-search nil)
>       ;; We surely do not want the value of `case-fold-search' to be
>       ;; changed in the middle of `expensive-computation'.
>       (expensive-computation))
>     (setq case-fold-search oldval))

That's easy: case-fold-search can be made local to each thread.

reply via email to

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