From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qk1-x744.google.com (mail-qk1-x744.google.com [IPv6:2607:f8b0:4864:20::744]) by sourceware.org (Postfix) with ESMTPS id 5A3F43857804 for ; Sat, 5 Sep 2020 02:46:20 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 5A3F43857804 Received: by mail-qk1-x744.google.com with SMTP id o64so8309179qkb.10 for ; Fri, 04 Sep 2020 19:46:20 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:in-reply-to:date:message-id :mime-version; bh=Zvw5Gfx8Cj+Wo6BLHqR5vxQgMnMabYrcVJgQqOI29OE=; b=q+ZdS1+9LAvacygZ2WlQEFWyY/fV0EHu4sCNoD9gTDf6z4Xr8JSeXQDduXBjeKpKpF l2//24wqErsXit63ngB4xyht+Z6ClC1wEIQ+lEN2XSbqyrjStX9hQbGgjZeeDjgApExp nu4+zXYsPWSGWXbr9OuX96EVhw3Wpm73837CCYQuuSJU97gQFv2fIQdXwmcoeIc0QNQ0 hzaJIAtZM1bJWttKrgNSCsA0VFrejIggHHmWCkicN/cmakrwBvHFq4zlhb7KXgmgdCrR 8vAhlHUMFoKFk6WBjXDOgsJJN2fTBXzoO493Tr2IU/DcfLhpDnzpbja9YIDi0huxhk/I VUcw== X-Gm-Message-State: AOAM533fSrCsbhwxuCDQbv7oAXp5Dl0HIqwkQ6qAK2Wv3D68Coyywfmj yi7pxXi9wx0u79cbWlZcHEhnCgXaWKo= X-Google-Smtp-Source: ABdhPJyBBAEs9hUmVW1iwwqnLS1O0jNkRzl2pgWJn2p/rG9CaKHd6YY2NzLuT+DPco6z/C/6YEAV8Q== X-Received: by 2002:ae9:dc86:: with SMTP id q128mr10797086qkf.451.1599273979385; Fri, 04 Sep 2020 19:46:19 -0700 (PDT) Received: from davidm-laptop (hlfxns018gw-134-41-167-80.dhcp-dynamic.fibreop.ns.bellaliant.net. [134.41.167.80]) by smtp.gmail.com with ESMTPSA id n204sm5848920qke.62.2020.09.04.19.46.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Sep 2020 19:46:18 -0700 (PDT) From: David McFarland To: cygwin-developers@cygwin.com Subject: Re: Re: Fibers and cygtls In-Reply-To: <20200904195143.GY4127@calimero.vinschen.de> Date: Fri, 04 Sep 2020 23:46:16 -0300 Message-ID: MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-3.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: cygwin-developers@cygwin.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Cygwin core component developers mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Sep 2020 02:46:21 -0000 > Bottom line is, before trying to use Windows fibers, or before letting > boost use Windows functions on Cygwin (sigh), check what other POSIX or > BSD systems provide to implement coroutines. If there's an API, let's > implement this API in Cygwin and then use that from user space. boost-context doesn't actually use Windows fibers by default. Its fiber implementation (fcontext) uses user-provided buffers for fiber stacks. The jump implementation is in: https://github.com/boostorg/context/blob/develop/src/asm/jump_x86_64_ms_pe_gas.asm On Linux I believe uses its own asm implementation without any kernel interaction: https://github.com/boostorg/context/blob/develop/src/asm/jump_x86_64_sysv_elf_gas.S There's also an implementation (ucontext) using makecontext, which may be the best option. I'll try that next. The implementations are compared here: https://www.boost.org/doc/libs/1_74_0/libs/context/doc/html/context/cc/implementations__fcontext_t__ucontext_t_and_winfiber.html