How to use asynchronous functions

,

I’m trying to figure out how to create my own asynchronous function in C. But all roads lead to g_task_run_in_thread. But this is running a function in another thread. How to use asynchronous functions (as in Vala)?

You want to use GTask. Review the documentation; it has examples to guide you.

It may be a little complicated your first time, but you’ll get used to it.

Thank you. I’ve read it. g_task_run_in_thread is really misleading, it was not immediately clear to me that GTask is just a tool for implementing asynchronous calls, and not a ready-made implementation.

Outside of the class documentation, you probably want to read the Asynchronous Programming tutorial on the GNOME developers documentation website.

3 Likes

This topic was automatically closed 45 days after the last reply. New replies are no longer allowed.