Hi! Dnia 2020-09-05, o godz. 18:19:49 Aleix Conchillo Flaqué <[email protected]> napisał(a):
> Hi! > > On Sat, Sep 5, 2020 at 3:48 PM Jan Wielkiewicz < > [email protected]> wrote: > > I believe sharing the same object by the two fibers defeats the > purpose of message passing, because with the way you are doing it you > find exactly the problem you are having and the only way to fix this > is by using mutexes. That is, you are trying to use fibers as you > would use regular threads sharing a resource. Instead, there should > probably be a main fiber (that holds the object) and send messages > (with the data needed from the object) to 2 other fibers (those would > be your methods A and B). I see, thank you for explanation. This allowed me to understand the problem doesn't lie in the way I was trying to implement my messaging through fibers, but rather in the way I was using GOOPS - my custom method for initializing slots called next-method after doing everything what caused some weird problems with allocation. Are threads and mutexes worth using, if there are fibers already? I know I'll have to learn this eventually, to fully master programming, but I'm not sure if there's a great advantage over fibers. > > I haven't used fibers extensively, but I've used Go quite a bit which > follows the same pattern of channels and message passing and this is > how you would do it. > > Also, the fibers manual also suggests this approach: > https://github.com/wingo/fibers/wiki/Manual#33-mutation Yeah, I've read the manual like three times already, but Andy is somethimes writing sentences from outer space, including the GOOPS manual. This isn't the level of English I'm currently on. I guess I'll write some self-explaining examples of GOOPS after I fully understand it. > That said, I might be wrong though. > > Hope this helps, > > Aleix Thanks for explanation, this made my thinking much cleaner. I can get back to experimenting now! Jan Wielkiewicz
