日韩av黄I国产麻豆传媒I国产91av视频在线观看I日韩一区二区三区在线看I美女国产在线I麻豆视频国产在线观看I成人黄色短片

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 >

g_thread_init

發布時間:2025/7/14 43 豆豆
生活随笔 收集整理的這篇文章主要介紹了 g_thread_init 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

NAME

g_thread_init?- 初始化線程系統

?

SYNOPSIS?

#include <glib.h> //in gthread.h

? void g_thread_init (GThreadFunctions *vtable);??

?

Date Structure?

typedef struct _GThreadFunctions GThreadFunctions; struct _GThreadFunctions {GMutex* (*mutex_new) (void);void (*mutex_lock) (GMutex *mutex);gboolean (*mutex_trylock) (GMutex *mutex);void (*mutex_unlock) (GMutex *mutex);void (*mutex_free) (GMutex *mutex);GCond* (*cond_new) (void);void (*cond_signal) (GCond *cond);void (*cond_broadcast) (GCond *cond);void (*cond_wait) (GCond *cond,GMutex *mutex);gboolean (*cond_timed_wait) (GCond *cond,GMutex *mutex,GTimeVal *end_time);void (*cond_free) (GCond *cond);GPrivate* (*private_new) (GDestroyNotify destructor);gpointer (*private_get) (GPrivate *private_key);void (*private_set) (GPrivate *private_key,gpointer data);void (*thread_create) (GThreadFunc func,gpointer data,gulong stack_size,gboolean joinable,gboolean bound,GThreadPriority priority,gpointer thread,GError **error);void (*thread_yield) (void);void (*thread_join) (gpointer thread);void (*thread_exit) (void);void (*thread_set_priority)(gpointer thread,GThreadPriority priority);void (*thread_self) (gpointer thread);gboolean (*thread_equal) (gpointer thread1,gpointer thread2); }; GThreadFunctions

?

DESCRIPTION

如果你在多個線程中使用Glib,那么你必須調用這個函數來初始化線程系統.

該函數不可以在Glib的CallBack中直接或間接被調用,Also no mutexes may be currently locked while calling?g_thread_init()。

使用該函數必須連接gthread庫,`pkg-config --libs gthread-2.0`

從v2.24版本開始,允許多次調用該函數,但是只有第一次調用有效,其他調用無效。

從v2.32版本開始,Glib不再支持自定義線程實現,vtable 參數會被忽略,所以參數?vtable 應該設置為NULL;

從v2.32版本開始,該函數已被棄用,因為Glib系統會在程序開始前自動完成線程系統初始化。?

?

PARAMETERS

①vtable

GThreadFunctions類型的函數table, v2.32版本后應該設置為NULL

?

?

?

轉載于:https://www.cnblogs.com/LubinLew/p/GLIB-g_thread_init.html

總結

以上是生活随笔為你收集整理的g_thread_init的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。