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: Re: repl-server from fibers task Date: Wed, 21 Dec 2022 07:43:27 -0800 Message-ID: <61accd27-1eeb-dd9f-5530-a696732ed5c5@gmail.com> References: 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="39800"; 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@gnu.org Original-X-From: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Wed Dec 21 16:43:59 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 1p81GB-000A9s-13 for guile-user@m.gmane-mx.org; Wed, 21 Dec 2022 16:43:59 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p81Fo-0002vG-4h; Wed, 21 Dec 2022 10:43:36 -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 1p81Fm-0002v7-EE for guile-user@gnu.org; Wed, 21 Dec 2022 10:43:34 -0500 Original-Received: from mail-pg1-x52f.google.com ([2607:f8b0:4864:20::52f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p81Fk-0002T1-0h for guile-user@gnu.org; Wed, 21 Dec 2022 10:43:33 -0500 Original-Received: by mail-pg1-x52f.google.com with SMTP id s196so10656922pgs.3 for ; Wed, 21 Dec 2022 07:43:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:from:content-language :references:to:subject:user-agent:mime-version:date:message-id:from :to:cc:subject:date:message-id:reply-to; bh=bE9ClZ/wHMbC4dJ7rgwBVMNx1/aR6rRi34W/XP+jltA=; b=Yxuu/+LaYWeUdQdoOpKUSNVfkjpMBrXIjCguhbDrqSD+nfQyMqOPnmH99C9gQ5r6Sn 23CvoKmrza2peWCMnQEKllqVI+JQagrQux1QJWve/mmbxVCnEK9uqUc2+H104r8cPIXm Z76J8b6RrXu9u0ucw38nxu0rBqxRl0PpwTYnI/JKtG7By946blUB7z31l5pYuWjd5Cy5 DVrFo7r7UWP1VGjW9WSk55liRflbyLvuF6eOUSvBNcIo2MtU7ZW0ZaENNNiwpNsX3ip7 Q2t+jxb8dleCXANVtw0yYnqbZi6tWV+8J3sqvIA9LEpqr0/08a845PuyaqKIgjFHAcYP TSYw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:content-language :references:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=bE9ClZ/wHMbC4dJ7rgwBVMNx1/aR6rRi34W/XP+jltA=; b=DBEA7wYeUeA0QaoplDUZp+drGJ0EoozjC5hWvooeeY1hcfZmWJKV6BrANdK9FpmTZ/ NFnqGivgBNlxR0FH+/jUcB7YE1zVzvlODPMmpaKbuvn+czhieX+oxq43yMx9s9FGw4bj FWSdv94eLdhavKR43CL1WqlBiSyZHZ+/ss1qjygpEqA40fATloK6yvMuWFWs9enGua20 BF43KlcbZkzoUbrwKzxiG6Q2J3qGqpdjwYNdkQUqVCqMAAMG5IHajWniCPhHAAitT35K LxdhS9UroIGs4Uunn+BTE40JF5uA69Hc4Xh1rpMepukrELDrJWUNcQ+gAoKsAWNjq34J AFDw== X-Gm-Message-State: AFqh2krd1Hdd157cYlgov4IJybyNxHIzy7Hva++0dakuefYpqslonoQ9 TR08ZkbngJwdg8TWIMJYvs2RDx5K2tI= X-Google-Smtp-Source: AMrXdXvUcfFVz+sRl/a7LacCJrW7g8d3PLCRAeAmlMgibTBxgzHDQ/lBjwFFgvEEHyJIlq2IMPoqvQ== X-Received: by 2002:a05:6a00:4309:b0:576:ebcd:5e0c with SMTP id cb9-20020a056a00430900b00576ebcd5e0cmr2719595pfb.0.1671637409650; Wed, 21 Dec 2022 07:43:29 -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 x18-20020aa79a52000000b00576c4540b63sm11103136pfj.12.2022.12.21.07.43.28 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 21 Dec 2022 07:43:29 -0800 (PST) Content-Language: en-US In-Reply-To: Received-SPF: pass client-ip=2607:f8b0:4864:20::52f; envelope-from=matt.wette@gmail.com; helo=mail-pg1-x52f.google.com X-Spam_score_int: -31 X-Spam_score: -3.2 X-Spam_bar: --- X-Spam_report: (-3.2 / 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, NICE_REPLY_A=-1.148, 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:18792 Archived-At: On 12/19/22 1:30 PM, Matt Wette wrote: > 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 I got something to work: #!/usr/bin/env guile # -*- scheme -*- !# ;; connect to monitor via ;;   $ telnet localhost 37146 (use-modules ((fibers) #:renamer (lambda (s) (if (eq? s 'sleep) 'fsleep s)))) (use-modules (fibers scheduler)) (use-modules (system repl server)) (use-modules (system repl coop-server)) (define (sf fmt . args) (apply simple-format #t fmt args)) (define (task1)   (let loop ((cnt 0))     (fsleep 1)     (sf "task1: ~S\n" cnt)     (loop (1+ cnt)))) (define (monitor)   (let* ((server (spawn-coop-repl-server)))     (let loop ()       (poll-coop-repl-server server)       (yield-current-task)       (loop)))) (run-fibers  (lambda ()    (spawn-fiber task1)    (spawn-fiber monitor)    (fsleep 30))  #:hz 0 #:install-suspendable-ports? #f) ;;; --- last line ---