A callback will not help at all, if there exists a mixture of short and long operations. Long operations would still prevent handling secondary (short) requests, which could be served (almost) instantly.
So
soup_message_unpause (...)
soup_message_set_status (...)
soup_message_set_response (...)are required to be the only ones modifing the session/message (which seems to work).How is the below supposed to be implemented? According to the API doc (stable) everything is being processed in one and the same GMainContext, correct me if I am wrong.Below the conceptual implementation with threads, which does contain potential races.
g_assert (!error);voidserver_callback(...)
{//do some basic checkssoup_server_pause_message (...);user_data... = ... //copy and ref all data which is requiredg_thread_try_new("worker", threaded_worker, user_data, &error)
g_signal_conncet (msg, "finished", finished_callback_does_cleanup, user_data)}gpointerthreaded_worker (..., user_data)
{if (is_long_op(user_data))super_long_op(...);elseshort_op(...);
soup_server_unpause_message (...);soup_message_set_status (...);soup_message_set_response (...);return NULL;}