guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

guile fibers - looking for adivce


From: Jan Wielkiewicz
Subject: guile fibers - looking for adivce
Date: Sun, 6 Sep 2020 02:47:57 +0200

Hello,

I'm still on my way of integrating Guile Fibers and GOOPS, but I
encountered some weird behavior.
Say I have an object with with one slot being a vector and two methods
accessing the vector concurrently/parallelly. The methods
accessing/editing the vector are time consuming and are meant to be ran
frequently. Assuming I would like to run the methods on separate
fibers, how do I make sure the state of the object doesn't
suddenly change during execution of a method? I would like the methods
to be able to edit the state of the object, but in a cooperative manner.

The weird behavior I've encountered is that sometimes when running the
first method (A) and right after starting the second method (B), the
method B tries to access the vector before the method A finishes its
job. What should I do to make accessing the vector cooperatively, yet
to run the time consuming on separate fibers for concurrency?

I was thinking about implementing slots in objects as sending and
receiving messages instead of regular variables, but still there were
some problems with the object state.

Could someone explain me what should I do?


Thanks in advance
Jan Wielkiewicz



reply via email to

[Prev in Thread] Current Thread [Next in Thread]