You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I run a JAPI server as part of a larger program where it is not started from the main() function, but from another thread.
When the program shuts down, I'd like to cleanly shut down the JAPI server as well. That is currently not possible because japi_start_server() is blocking and cannot be interacted with from the outside.
Example code for explanation of the issue:
// called by larger application's frameworkvoidstart(void)
{
d_japi_thread = start_thread(japi_thread); // starts japi_thread() as separate thread
}
// called by larger application's frameworkvoidstop(void)
{
// Shut down the thread -> how? japi_shutdown() would be nice
d_japi_thread->join(); // join() blocks forever :-(
}
voidjapi_thread(void)
{
japi_context *ctx = japi_init(this);
// japi setup code left out for brevityint ret = japi_start_server(ctx, this->port); // blocking call// this part is never reached except if an error occursjapi_pushsrv_stop(pushctx_stats);
japi_destroy(ctx);
}
As pointed out above, a japi_shutdown(ctx) function would be nice that causes japi_start_server() to return. japi_shutdown() would have to be thread-safe.
The text was updated successfully, but these errors were encountered:
In GitLab by @kolb on Nov 25, 2019, 10:52
I run a JAPI server as part of a larger program where it is not started from the
main()
function, but from another thread.When the program shuts down, I'd like to cleanly shut down the JAPI server as well. That is currently not possible because
japi_start_server()
is blocking and cannot be interacted with from the outside.Example code for explanation of the issue:
As pointed out above, a
japi_shutdown(ctx)
function would be nice that causesjapi_start_server()
to return.japi_shutdown()
would have to be thread-safe.The text was updated successfully, but these errors were encountered: