Update label before waiting for Oracle reply

, ,

Hi all,
I’d like to understand (and solve) the problem I have with a long running request.
The idea is simple: the program wait for a numeric code. This code is read by the classic callback function:

static gboolean onKeyPressed( GtkWidget* self, GdkEventKey* event, gpointer user_data)

In this function I build the entered code and I’d like to update a GtkLabel content with a message like ‘Wait for reply …’ before I run the db request by the Oracle library. This call is synchronous so the label is not refreshed … and, among other things, it crashed when the server is not available.

I also tried both
gdk_threads_add_idle( UpdateMessage, NULL);
but nothing.

Please, can you point me a correct way to handle this requirement?


If there’s no way to make it async, then you need to do your blocking call in another thread. Please refer to: