Re: [go-nuts] How could we emulate condition variables using Go channels only?

2024-01-12 Thread Rochus Keller
> Something like this? https://go.dev/play/p/_H3kFjprAGG

No, sorry. The goal is to emulate a full monitor just with channels, as 
demonstrated in the referenced text (see the Stack example). The Mutex is 
likely correct, but the Signal has yet to pass the scrutinity of the folks 
here.

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/8f85e31d-103c-4138-a4a6-e7e56f871bc3n%40googlegroups.com.


[go-nuts] How could we emulate condition variables using Go channels only?

2024-01-12 Thread Rochus Keller

Here is the full question with examples (though meanwhile closed as usual 
in recent times on stackoverflow, so answer here please): 
https://stackoverflow.com/questions/77802102/mutex-and-condition-variables-in-go-without-using-the-sync-package

This is a conceptual question based on the duality of monitors and message 
passing. My goal is to see and be able to experiment with a correct and 
complete example of a mutex with condition variables in Go which only use 
Go channels for implementation, as a proof of concept. Only then we can 
discuss how far it makes sense from an engineering standpoint.

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/e31ddd07-8e08-4cce-8232-210534ef1515n%40googlegroups.com.