From: Amirouche Boubekki <amirouche@hypermove.net>
To: "Clément Lassieur" <clement@lassieur.org>
Cc: guile-devel
<guile-devel-bounces+amirouche+dev=hypermove.net@gnu.org>,
guile-devel@gnu.org
Subject: Re: crashes with Fibers
Date: Mon, 02 Jul 2018 00:46:45 +0200 [thread overview]
Message-ID: <4995bab49d42634968d6029bc595b2aa@hypermove.net> (raw)
In-Reply-To: <43f3442d6a3b2e18db597b2df68bf8da@hypermove.net>
On 2018-07-02 00:41, Amirouche Boubekki wrote:
> On 2018-07-02 00:32, Amirouche Boubekki wrote:
>> On 2018-07-01 15:09, Clément Lassieur wrote:
>>> Amirouche Boubekki <amirouche@hypermove.net> writes:
>>>
>>>> Sorry, I did not read the code. What are you trying to achieve?
>>>
>>> Within a fiber, I need to spawn several Guile-Git clones in parallel.
>>> Since they block the Fibers scheduler, they need to be in separate
>>> threads.
>>
>> I tried that in the past it was working, but don't remember correctly
>> how I did.
>
>> epoll is dead seems to indicate that there is no fiber scheduler
>> running
>> from the thread your are calling put-message. This might be a design
>> decision
>> or not. My understanding is that your code should work as intended.
>
> You test5 code should definitly work. Otherwise, it requires to
> pre-allocate
> as many thread as you need before you know you will them. May be we can
> look
> at it backward and say, that allocating a pool of threads in advance is
> more
> interesting performance wise.
>
>> Anyway, try to spawn the thread and/or create the channel before you
>> run fibers. I can't try that myself because of my slow connection
>> which
>> takes ages to install guile-fibers.
>>
>> Something like:
>
> (use-modules (fibers))
> (use-modules (fibers channels))
>
>> (define (test6)
>> (let ((channel (make-channel)))
>> (call-with-new-thread
>> (lambda ()
>> (put-message channel "hello world")))
>> (run-fibers
>> (lambda ()
>> (spawn-fiber
>> (lambda ()
>> (format #t "~a~%" (get-message channel)))))
>> #:drain? #t)))
>
> It works on my side.
FWIW, the following code doesn't crash, but apparently does nothing:
(define (test7)
(let ((channel (make-channel)))
(run-fibers
(lambda ()
(spawn-fiber
(lambda ()
(call-with-new-thread
(lambda ()
(put-message channel "hello world")))
(format #t "~a~%" (get-message channel)))))
#:drain? #t)))
next prev parent reply other threads:[~2018-07-01 22:46 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-29 9:20 crashes with Fibers Clément Lassieur
2018-07-01 11:16 ` Amirouche Boubekki
2018-07-01 13:09 ` Clément Lassieur
2018-07-01 22:32 ` Amirouche Boubekki
2018-07-01 22:41 ` Amirouche Boubekki
2018-07-01 22:46 ` Amirouche Boubekki [this message]
2018-07-02 9:22 ` Clément Lassieur
2018-07-02 9:32 ` Ludovic Courtès
2018-07-02 11:34 ` Clément Lassieur
2018-07-17 18:16 ` Clément Lassieur
2018-07-19 23:50 ` Amirouche Boubekki
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4995bab49d42634968d6029bc595b2aa@hypermove.net \
--to=amirouche@hypermove.net \
--cc=clement@lassieur.org \
--cc=guile-devel-bounces+amirouche+dev=hypermove.net@gnu.org \
--cc=guile-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).