Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.prolog > #13985

Re: Request for comments, async ISO core standard I/O

Path csiph.com!news.mixmin.net!weretis.net!feeder8.news.weretis.net!reader5.news.weretis.net!news.solani.org!.POSTED!not-for-mail
From Mild Shock <janburse@fastmail.fm>
Newsgroups comp.lang.prolog
Subject Re: Request for comments, async ISO core standard I/O
Date Thu, 22 Feb 2024 11:18:20 +0100
Message-ID <ur771d$f2lp$1@solani.org> (permalink)
References <7e154664-d8d9-46f2-ade4-9b9a7712a2den@googlegroups.com> <1f804201-3aa6-4fbc-b1c3-f3887b304675n@googlegroups.com>
MIME-Version 1.0
Content-Type text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding 7bit
Injection-Date Thu, 22 Feb 2024 10:18:21 -0000 (UTC)
Injection-Info solani.org; logging-data="494265"; mail-complaints-to="abuse@news.solani.org"
User-Agent Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Firefox/91.0 SeaMonkey/2.53.18.1
Cancel-Lock sha1:vdCM8dG7//PlnUGv9nPcxjVYgGM=
X-User-ID eJwNysERwDAIA7CVSoJNGYeasP8IzVN3wqZR4QQdg7nyB4ehQ31QvcpTARuOsT32U1qr1cjKauVNLaMdeZf/YkUWfw==
In-Reply-To <1f804201-3aa6-4fbc-b1c3-f3887b304675n@googlegroups.com>
Xref csiph.com comp.lang.prolog:13985

Show key headers only | View raw


Now asyncifying I/O of Dogelog Player for Python.
I guess we got our head around the equivalents
of our Java Surrogate async/await constructs

"Promise" and "Coroutine". The key utilities among
asyncio are asyncio.to_thread an asyncio.run_coroutine_threadsafe,
which seem toe especially made for the two use cases.

Namely what was our Java Surrogate "Promise" wrapper,
now looks like here, what a wonderful code gem:


async def console_promise(buf, stream):
     try:
         res = await asyncio.to_thread(blocking_readline, stream.data)
         stream.buf = res
         stream.pos = 0
     except IOError as err:
         register_signal(buf, map_stream_error(err))


def blocking_readline(data):
     return data.readline()


And what was our Java Surrogate "Coroutine" wrapper,
now looks like here, what a wonderful code gem again:

def test_sys_http_server_on(args):
    [...]
     obj.func = lambda req, res: baby_come_back(
             launch_async(clause, buf, [req, res]), loop)


def baby_come_back(coro, loop):
     future = asyncio.run_coroutine_threadsafe(coro, loop)
     return future.result()

LoL

Back to comp.lang.prolog | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Request for comments, async ISO core standard I/O Mostowski Collapse <bursejan@gmail.com> - 2022-08-10 00:28 -0700
  Re: Request for comments, async ISO core standard I/O Mostowski Collapse <bursejan@gmail.com> - 2022-08-10 00:29 -0700
    Re: Request for comments, async ISO core standard I/O Mostowski Collapse <bursejan@gmail.com> - 2022-08-10 01:20 -0700
      Re: Request for comments, async ISO core standard I/O Mostowski Collapse <bursejan@gmail.com> - 2022-08-11 05:41 -0700
        Re: Request for comments, async ISO core standard I/O Mostowski Collapse <bursejan@gmail.com> - 2022-08-11 05:52 -0700
          Re: Request for comments, async ISO core standard I/O Mostowski Collapse <bursejan@gmail.com> - 2022-08-11 06:23 -0700
            Re: Request for comments, async ISO core standard I/O Mostowski Collapse <bursejan@gmail.com> - 2022-08-11 08:27 -0700
              Re: Request for comments, async ISO core standard I/O Mostowski Collapse <bursejan@gmail.com> - 2022-08-12 06:49 -0700
                Re: Request for comments, async ISO core standard I/O Mostowski Collapse <bursejan@gmail.com> - 2022-08-12 06:54 -0700
                Re: Request for comments, async ISO core standard I/O Mostowski Collapse <bursejan@gmail.com> - 2022-08-12 06:56 -0700
                Re: Request for comments, async ISO core standard I/O Mostowski Collapse <bursejan@gmail.com> - 2022-08-14 01:48 -0700
                Re: Request for comments, async ISO core standard I/O Mostowski Collapse <bursejan@gmail.com> - 2022-08-14 07:37 -0700
                Re: Request for comments, async ISO core standard I/O Mostowski Collapse <bursejan@gmail.com> - 2022-08-14 07:38 -0700
                Re: Request for comments, async ISO core standard I/O Mostowski Collapse <bursejan@gmail.com> - 2022-08-14 07:39 -0700
                Re: Request for comments, async ISO core standard I/O Mostowski Collapse <bursejan@gmail.com> - 2022-08-14 07:47 -0700
                Re: Request for comments, async ISO core standard I/O Mostowski Collapse <bursejan@gmail.com> - 2022-08-14 07:59 -0700
                Re: Request for comments, async ISO core standard I/O Mostowski Collapse <bursejan@gmail.com> - 2022-08-14 08:12 -0700
                Re: Request for comments, async ISO core standard I/O Mostowski Collapse <bursejan@gmail.com> - 2022-08-20 04:41 -0700
                Re: Request for comments, async ISO core standard I/O Mostowski Collapse <bursejan@gmail.com> - 2022-08-20 04:42 -0700
                Re: Request for comments, async ISO core standard I/O Mostowski Collapse <bursejan@gmail.com> - 2022-08-20 11:22 -0700
                Re: Request for comments, async ISO core standard I/O Mostowski Collapse <bursejan@gmail.com> - 2022-08-20 11:25 -0700
                Re: Request for comments, async ISO core standard I/O Mostowski Collapse <bursejan@gmail.com> - 2022-08-21 00:57 -0700
                Re: Request for comments, async ISO core standard I/O Mostowski Collapse <bursejan@gmail.com> - 2022-08-22 19:30 -0700
                Re: Request for comments, async ISO core standard I/O Mostowski Collapse <bursejan@gmail.com> - 2022-08-22 19:31 -0700
              Re: Request for comments, async ISO core standard I/O Mostowski Collapse <bursejan@gmail.com> - 2022-08-24 06:08 -0700
                Re: Request for comments, async ISO core standard I/O Mostowski Collapse <bursejan@gmail.com> - 2022-08-24 06:10 -0700
                Re: Request for comments, async ISO core standard I/O Mostowski Collapse <bursejan@gmail.com> - 2022-08-24 06:38 -0700
                Re: Request for comments, async ISO core standard I/O Mostowski Collapse <bursejan@gmail.com> - 2022-08-24 12:18 -0700
                Re: Request for comments, async ISO core standard I/O Mostowski Collapse <bursejan@gmail.com> - 2022-09-04 14:19 -0700
                Re: Request for comments, async ISO core standard I/O Mostowski Collapse <bursejan@gmail.com> - 2022-09-15 14:09 -0700
                Re: Request for comments, async ISO core standard I/O Mostowski Collapse <janburse@fastmail.fm> - 2022-09-16 02:54 +0200
                Re: Request for comments, async ISO core standard I/O Mostowski Collapse <bursejan@gmail.com> - 2022-10-06 12:43 -0700
                Re: Request for comments, async ISO core standard I/O Mostowski Collapse <bursejan@gmail.com> - 2022-10-06 12:46 -0700
                Re: Request for comments, async ISO core standard I/O Mostowski Collapse <bursejan@gmail.com> - 2022-10-06 12:48 -0700
                Re: Request for comments, async ISO core standard I/O Mostowski Collapse <bursejan@gmail.com> - 2022-08-24 11:01 -0700
                Re: Request for comments, async ISO core standard I/O Mostowski Collapse <bursejan@gmail.com> - 2022-08-24 11:02 -0700
  Re: Request for comments, async ISO core standard I/O Mostowski Collapse <bursejan@gmail.com> - 2023-03-09 08:47 -0800
    Re: Request for comments, async ISO core standard I/O Mostowski Collapse <bursejan@gmail.com> - 2023-03-09 08:53 -0800
    Re: Request for comments, async ISO core standard I/O Mild Shock <janburse@fastmail.fm> - 2024-02-22 11:18 +0100
      Re: Request for comments, async ISO core standard I/O Mild Shock <janburse@fastmail.fm> - 2024-02-22 11:26 +0100
        Re: Request for comments, async ISO core standard I/O Mild Shock <bursejan@gmail.com> - 2024-02-22 03:49 -0800
    Re: Request for comments, async ISO core standard I/O Mild Shock <janburse@fastmail.fm> - 2024-03-05 15:08 +0100
    Re: Request for comments, async ISO core standard I/O Mild Shock <janburse@fastmail.fm> - 2024-03-16 01:29 +0100
      Re: Request for comments, async ISO core standard I/O Mild Shock <janburse@fastmail.fm> - 2024-03-16 01:39 +0100
        Re: Request for comments, async ISO core standard I/O Mild Shock <janburse@fastmail.fm> - 2024-03-16 01:48 +0100
          Re: Request for comments, async ISO core standard I/O Mild Shock <janburse@fastmail.fm> - 2024-03-16 01:53 +0100
  Re: Request for comments, async ISO core standard I/O Mild Shock <bursejan@gmail.com> - 2024-02-01 14:01 -0800
    Re: Request for comments, async ISO core standard I/O Mild Shock <bursejan@gmail.com> - 2024-02-01 14:09 -0800
      Re: Request for comments, async ISO core standard I/O Mild Shock <bursejan@gmail.com> - 2024-02-01 14:16 -0800
  Re: Request for comments, async ISO core standard I/O Mild Shock <bursejan@gmail.com> - 2024-02-14 03:38 -0800
    Re: Request for comments, async ISO core standard I/O Mild Shock <bursejan@gmail.com> - 2024-02-14 03:48 -0800
      Re: Request for comments, async ISO core standard I/O Mild Shock <bursejan@gmail.com> - 2024-02-14 04:01 -0800
        Re: Request for comments, async ISO core standard I/O Mild Shock <bursejan@gmail.com> - 2024-02-14 04:39 -0800

csiph-web