Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
実行中にGLibのタイムアウト間隔を変更する必要があります。それは可能ですか?ソースコードを調べたところ、それは可能だと思われますが、GLib内部の非公開関数を使用する必要があります。GTimeoutSourceを再実装する必要がありますか、それともそれを行う方法がありますか?
タイムアウト関数では、新しいタイムアウト間隔で関数を再度追加してから、戻っFALSEて古い間隔でタイムアウトを削除できます。
FALSE
gboolean my_timeout_function(gpointer data) { // do stuff // ... if(need_to_change_interval) { g_timeout_add(new_interval, (GSourceFunc)my_timeout_function, data); return FALSE; } return TRUE; }