← Back to team overview

coapp-developers team mailing list archive

Re: Async notification from CoApp Engine (libCoApp)

 

I'm not Elizabeth, but since there was no reply (at least not that I can
see), I'll bite.  Basically, there are only two (sensible) ways to do it:
callbacks, or a "get current status" function.  The former is very common,
but does require a bit of thread safety awareness in the app's callback
implementation, since they obviously won't be called from the same thread
the app's main loop is running in.  The "get current status" function means
you don't have to care about thread safety in the calling code (unless you
want to write a multi-threaded client for other reasons), but obviously the
code has to keep polling the library, which can be nasty in and of itself.

Or, you have a hybrid model which is either really fantastic and elegant, or
a hideous monstrosity - I can't quite decide: optional callback usage, where
the default callback (internal to the library) updates the internal
structure used by the "get current status" function in a thread-safe
fashion.

Unless anyone has any good reason to do it another way, I vote callbacks.

Regards,
Phil

Follow ups

References