vsf-tv / gccg-api

Draft API for the Ground-Cloud-Cloud-Ground Working Group: https://vsf.tv/Ground-Cloud-Cloud-Ground.shtml
BSD 2-Clause "Simplified" License
3 stars 2 forks source link

Not 100% clear how to incorporate this into an event loop #4

Closed kierank closed 7 months ago

kierank commented 7 months ago

You can do callbacks, but what do you poll on and how do you incorporate into an event loop.

mhhen commented 7 months ago

Adding these new APIs to support single threaded event loop and thread usage by the underlying API's implementation:

/**
 * @brief Initialize the GCCG transport API. This sets limits on the number of threads and thread priority that the
 * underlying API can use. If this API is not invoked, thread usage within the underlying API is not restricted.
 * 
 * @param maximum_thread_count Maximum number of threads the underlying API can use.
 * @param maximum_thread_priority Maximum thread priority the underlying API can use. The range is 0 (lowest) to
 *                                99 (highest).
 *
 * @return A value from the GccgReturnStatus enumeration.
 */
GCCG_INTERFACE GccgReturnStatus GccgInitialize(int maximum_thread_count, int maximum_thread_priority);

/**
 * @brief Only required when using a single-threaded, event loop to service the API.
 * 
 * @param handle Connection handle returned by one of the create connection functions.
 * 
 * @return A value from the GCCG_INTERFACE enumeration.
 */
GCCG_INTERFACE GccgReturnStatus GccgEventLoopPoll(GccgConnectionHandle handle);
mhhen commented 7 months ago

Addressed by: https://github.com/vsf-tv/gccg-api/pull/11