From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Matt Wette Newsgroups: gmane.lisp.guile.user Subject: repl-server from fibers task Date: Mon, 19 Dec 2022 13:30:32 -0800 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="26599"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 To: Guile User Original-X-From: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Mon Dec 19 22:31:17 2022 Return-path: Envelope-to: guile-user@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1p7NjA-0006nh-S0 for guile-user@m.gmane-mx.org; Mon, 19 Dec 2022 22:31:16 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p7Nii-0003Me-LH; Mon, 19 Dec 2022 16:30:48 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p7Nib-0003MH-JH for guile-user@gnu.org; Mon, 19 Dec 2022 16:30:41 -0500 Original-Received: from mail-pl1-x633.google.com ([2607:f8b0:4864:20::633]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p7NiZ-0002FZ-Sg for guile-user@gnu.org; Mon, 19 Dec 2022 16:30:41 -0500 Original-Received: by mail-pl1-x633.google.com with SMTP id 4so10322952plj.3 for ; Mon, 19 Dec 2022 13:30:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:subject:from:to:content-language :user-agent:mime-version:date:message-id:from:to:cc:subject:date :message-id:reply-to; bh=Pd1koS/VEF8X+xwqogA1pe1MOIlACikpOlhBpg70lqg=; b=nyGod1d1Kr2KWSjX+6boEuBNzjMvtOAy1xhsDrt4NFpdR//LfLI6R/rsY6B6LKNdtz IAKSyW/f21r602qJmiHIJsYpW8xLcEyZRj7YLE7Clr71no6LKwCNoNTiqvhm8eyNKwD7 iOeLy5nTB6dmUjUonVCuS5ZWdC/q+wC8gFcfPBhjNqoeUCeguWfq8esSsSSHFnhxG42M e8OZp6qyu2vS+UllEHXoUvhRuLVde/zvsVHCloDh6cX6ux2E99839kBachQ/oNfYanvt zap92Ks7wvRim6iFfsXen0BiJARENKqGhVhVP3KBCk8JuHW7uUbcYGDR80ZIynZQginZ nXNA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:subject:from:to:content-language :user-agent:mime-version:date:message-id:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=Pd1koS/VEF8X+xwqogA1pe1MOIlACikpOlhBpg70lqg=; b=RlwX5C6p4lE7sJatfarpcdNv5JfNIKTUMOJ/LRZ0lUiBtukCBC4f8eFdUSqnJYCNoh 2k5nQunVOVbZTSzdz0ZQ8n5se+Pvxo2AXA4OTzF31CjolqswoGDtXnd4OHx9SDZ0p/hH heFebMxSegDAu7nMpJ0dg4vIVXxfVBaV1wvUsVe1HsrVQuXgcUAaVQsNPBRVVkRfCUIw RPeCOMsn3ReJBEPl4RcBx8DT7yDT/agA7Sv4FVD2hLfHfbl/GImwWyieczb/VIdntdZj QPxriFn/c9FiHt6X3yBsA2fUtV/3OCeVBlH2VgJ2kPx+adfnU2SxbLIjDl0ryqJHHL0G xM/Q== X-Gm-Message-State: ANoB5pkSlCmMdyo6/Jrs8XgJonDrMvq1HJW6wBQsl9RRnlBCMWRjdsYs 00/Dd1xmZsGuCDXJqZ3tRcuaOA18RH8= X-Google-Smtp-Source: AA0mqf4wSdYMluxQgWtANrFtV7dMcKP1s/dMjBfhyOjTAEIMYolVYenrLo49kZTNKiZwu/mZ0ARRQA== X-Received: by 2002:a17:90a:194b:b0:220:bbe1:1fde with SMTP id 11-20020a17090a194b00b00220bbe11fdemr39848296pjh.14.1671485435503; Mon, 19 Dec 2022 13:30:35 -0800 (PST) Original-Received: from [192.168.2.158] (64-52-138-37.championbroadband.com. [64.52.138.37]) by smtp.gmail.com with ESMTPSA id z189-20020a6333c6000000b004785e505bcdsm6783490pgz.51.2022.12.19.13.30.34 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 19 Dec 2022 13:30:34 -0800 (PST) Content-Language: en-US Received-SPF: pass client-ip=2607:f8b0:4864:20::633; envelope-from=matt.wette@gmail.com; helo=mail-pl1-x633.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Original-Sender: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.lisp.guile.user:18791 Archived-At: Hi All, I'm trying to get fibers to run in "pure asynchronous" style with a repl-server. By "pure asynchronous" style I mean #:hz 0 and possibly #:suspendable-ports #f. My only guess is that maybe the repl-server has a continuation barrier in the way. Either the other task runs, and I get no connection to the repl-server, or vice versa. Anyone here gotten this to work?  If the code worked below the main terminal would be counting along while one could telnet in from another source and use the repl. Any help appreciated. Matt #!/usr/bin/env guile # -*- scheme -*- !# ;; connect to monitor via ;;   $ telnet localhost 37146 (use-modules (fibers)) (use-modules (fibers scheduler)) (use-modules (system repl server)) (define (sf fmt . args) (apply simple-format #t fmt args)) (define (task1)   (let loop ((cnt 0))     (sleep 1)     (sf "task1: ~S\n" cnt)     (loop (1+ cnt)))) (define monitor   (let ((sock (make-tcp-server-socket)))     (fcntl sock F_SETFL (logior O_NONBLOCK (fcntl sock F_GETFL)))     (add-hook! before-read-hook (lambda () (yield-current-task)))     (lambda () (run-server sock)))) (run-fibers  (lambda ()    (spawn-fiber task1)    (spawn-fiber monitor)    (sleep 30))  #:scheduler (make-scheduler #:parallelism 2)  #:hz 0  #:install-suspendable-ports? #f) ;;; --- last line ---