Closed alexchamberlain closed 7 years ago
It looks like you're reimplementing curio.Event
along the way here?
It is very similar, indeed. Do they serve the same purpose? If so, maybe it would be sufficient to add data/exception elements to Event
.
I don't think it makes sense to add data/exception elements to Event
, but an Event
could replace your done
bool + condition variable. (You'd use the condition variable's locking, but it isn't doing anything here anyway, because you never hold the lock over a yield.)
Done; I've left it as 2 commits, but can squash before this is landed.
Simple
Promise
prototype, with basic get/set and exception handling.Open questions include:
_data
and_exception
members, or would testing for an exception be sufficient?_done
or is_data is not None or _exception is not None
sufficient? I think we do so you can pass backNone
.ToDo
Thoughts? Any other test cases needed?