[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Example of threads and concurrency?
From: |
Eric Abrahamsen |
Subject: |
Re: Example of threads and concurrency? |
Date: |
Sun, 19 Feb 2017 11:50:04 -0800 |
User-agent: |
Gnus/5.130014 (Ma Gnus v0.14) Emacs/26.0 (gnu/linux) |
Eli Zaretskii <address@hidden> writes:
>> From: Eric Abrahamsen <address@hidden>
>> Date: Sat, 18 Feb 2017 12:40:54 -0800
>>
>> In my dumb example I had indeed expected to use accept-process-output.
>> But there's not a whole lot of advantage of using threads plus
>> accept-process-output over just using start|make-process with sentinels
>> and callbacks, right?
>
> It depends on what your network- or process-related code needs to do.
> If it just reads whatever the process has to give and that's all, then
> indeed, these two methods are roughly equivalent. But if it has some
> more complex processing, like waiting for the process, dealing with
> errors, interacting with it, etc., then running that in a separate
> thread can make your code much simpler and easier to write, while
> letting the main thread (and thus the user) go about its business.
Okay, that makes sense.
Thanks again!
Eric