Snapchat / djinni

A tool for generating cross-language type declarations and interface bindings. Djinni's new home is in the Snapchat org.
Apache License 2.0
166 stars 44 forks source link

Add waitFor to djinni::Future #175

Open jb-gcx opened 4 days ago

jb-gcx commented 4 days ago

My project needs the ability to wait on a future with a timeout, mostly to make sure unit tests don't hang forever if unexpected things happen. I thought this might be useful for others as well.

In waitImpl, I used the same scheme as std::condition_variable::wait_until for dealing with clocks. This way it should be easy to add djinni::Future::waitUntil if needed.