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 <amirou...@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)))