⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gthread.h

📁 windows平台下开发gtk程序所需要的库和头文件等
💻 H
📖 第 1 页 / 共 2 页
字号:
#define g_cond_free(cond)        G_THREAD_CF (cond_free,      (void)0, (cond))#define g_private_new(destructor) G_THREAD_UF (private_new, (destructor))#define g_private_get(private_key) G_THREAD_CF (private_get, \                                                ((gpointer)private_key), \                                                (private_key))#define g_private_set(private_key, value) G_THREAD_CF (private_set, \                                                       (void) (private_key = \                                                        (GPrivate*) (value)), \                                                       (private_key, value))#define g_thread_yield()              G_THREAD_CF (thread_yield, (void)0, ())#define g_thread_create(func, data, joinable, error)			\  (g_thread_create_full (func, data, 0, joinable, FALSE, 		\                         G_THREAD_PRIORITY_NORMAL, error))GThread* g_thread_create_full  (GThreadFunc            func,                                gpointer               data,                                gulong                 stack_size,                                gboolean               joinable,                                gboolean               bound,                                GThreadPriority        priority,                                GError               **error);GThread* g_thread_self         (void);void     g_thread_exit         (gpointer               retval);gpointer g_thread_join         (GThread               *thread);void     g_thread_set_priority (GThread               *thread,                                GThreadPriority        priority);/* GStaticMutexes can be statically initialized with the value * G_STATIC_MUTEX_INIT, and then they can directly be used, that is * much easier, than having to explicitly allocate the mutex before * use */#define g_static_mutex_lock(mutex) \    g_mutex_lock (g_static_mutex_get_mutex (mutex))#define g_static_mutex_trylock(mutex) \    g_mutex_trylock (g_static_mutex_get_mutex (mutex))#define g_static_mutex_unlock(mutex) \    g_mutex_unlock (g_static_mutex_get_mutex (mutex))void g_static_mutex_init (GStaticMutex *mutex);void g_static_mutex_free (GStaticMutex *mutex);struct _GStaticPrivate{  /*< private >*/  guint index;};#define G_STATIC_PRIVATE_INIT { 0 }void     g_static_private_init           (GStaticPrivate   *private_key);gpointer g_static_private_get            (GStaticPrivate   *private_key);void     g_static_private_set            (GStaticPrivate   *private_key,					  gpointer          data,					  GDestroyNotify    notify);void     g_static_private_free           (GStaticPrivate   *private_key);typedef struct _GStaticRecMutex GStaticRecMutex;struct _GStaticRecMutex{  /*< private >*/  GStaticMutex mutex;  guint depth;  GSystemThread owner;};#define G_STATIC_REC_MUTEX_INIT { G_STATIC_MUTEX_INIT }void     g_static_rec_mutex_init        (GStaticRecMutex *mutex);void     g_static_rec_mutex_lock        (GStaticRecMutex *mutex);gboolean g_static_rec_mutex_trylock     (GStaticRecMutex *mutex);void     g_static_rec_mutex_unlock      (GStaticRecMutex *mutex);void     g_static_rec_mutex_lock_full   (GStaticRecMutex *mutex,                                         guint            depth);guint    g_static_rec_mutex_unlock_full (GStaticRecMutex *mutex);void     g_static_rec_mutex_free        (GStaticRecMutex *mutex);typedef struct _GStaticRWLock GStaticRWLock;struct _GStaticRWLock{  /*< private >*/  GStaticMutex mutex;  GCond *read_cond;  GCond *write_cond;  guint read_counter;  gboolean have_writer;  guint want_to_read;  guint want_to_write;};#define G_STATIC_RW_LOCK_INIT { G_STATIC_MUTEX_INIT, NULL, NULL, 0, FALSE, 0, 0 }void      g_static_rw_lock_init           (GStaticRWLock* lock);void      g_static_rw_lock_reader_lock    (GStaticRWLock* lock);gboolean  g_static_rw_lock_reader_trylock (GStaticRWLock* lock);void      g_static_rw_lock_reader_unlock  (GStaticRWLock* lock);void      g_static_rw_lock_writer_lock    (GStaticRWLock* lock);gboolean  g_static_rw_lock_writer_trylock (GStaticRWLock* lock);void      g_static_rw_lock_writer_unlock  (GStaticRWLock* lock);void      g_static_rw_lock_free           (GStaticRWLock* lock);void	  g_thread_foreach         	  (GFunc    	  thread_func,					   gpointer 	  user_data);typedef enum{  G_ONCE_STATUS_NOTCALLED,  G_ONCE_STATUS_PROGRESS,  G_ONCE_STATUS_READY  } GOnceStatus;typedef struct _GOnce GOnce;struct _GOnce{  volatile GOnceStatus status;  volatile gpointer retval;};#define G_ONCE_INIT { G_ONCE_STATUS_NOTCALLED, NULL }gpointer g_once_impl (GOnce *once, GThreadFunc func, gpointer arg);#ifdef G_ATOMIC_OP_MEMORY_BARRIER_NEEDED# define g_once(once, func, arg) g_once_impl ((once), (func), (arg))#else /* !G_ATOMIC_OP_MEMORY_BARRIER_NEEDED*/# define g_once(once, func, arg) \  (((once)->status == G_ONCE_STATUS_READY) ? \   (once)->retval : \   g_once_impl ((once), (func), (arg)))#endif /* G_ATOMIC_OP_MEMORY_BARRIER_NEEDED *//* initialize-once guards, keyed by value_location */G_INLINE_FUNC gboolean  g_once_init_enter       (volatile gsize *value_location);gboolean                g_once_init_enter_impl  (volatile gsize *value_location);void                    g_once_init_leave       (volatile gsize *value_location,                                                 gsize           initialization_value);#if defined (G_CAN_INLINE) || defined (__G_THREAD_C__)G_INLINE_FUNC gbooleang_once_init_enter (volatile gsize *value_location){  if G_LIKELY (g_atomic_pointer_get ((void*volatile*) value_location) != NULL)    return FALSE;  else    return g_once_init_enter_impl (value_location);}#endif /* G_CAN_INLINE || __G_THREAD_C__ *//* these are some convenience macros that expand to nothing if GLib * was configured with --disable-threads. for using StaticMutexes, * you define them with G_LOCK_DEFINE_STATIC (name) or G_LOCK_DEFINE (name) * if you need to export the mutex. With G_LOCK_EXTERN (name) you can * declare such an globally defined lock. name is a unique identifier * for the protected varibale or code portion. locking, testing and * unlocking of such mutexes can be done with G_LOCK(), G_UNLOCK() and * G_TRYLOCK() respectively. */extern void glib_dummy_decl (void);#define G_LOCK_NAME(name)               g__ ## name ## _lock#ifdef  G_THREADS_ENABLED#  define G_LOCK_DEFINE_STATIC(name)    static G_LOCK_DEFINE (name)#  define G_LOCK_DEFINE(name)           \    GStaticMutex G_LOCK_NAME (name) = G_STATIC_MUTEX_INIT#  define G_LOCK_EXTERN(name)           extern GStaticMutex G_LOCK_NAME (name)#  ifdef G_DEBUG_LOCKS#    define G_LOCK(name)                G_STMT_START{             \        g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG,                   \               "file %s: line %d (%s): locking: %s ",             \               __FILE__,        __LINE__, G_STRFUNC,              \               #name);                                            \        g_static_mutex_lock (&G_LOCK_NAME (name));                \     }G_STMT_END#    define G_UNLOCK(name)              G_STMT_START{             \        g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG,                   \               "file %s: line %d (%s): unlocking: %s ",           \               __FILE__,        __LINE__, G_STRFUNC,              \               #name);                                            \       g_static_mutex_unlock (&G_LOCK_NAME (name));               \     }G_STMT_END#    define G_TRYLOCK(name)                                       \        (g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG,                  \               "file %s: line %d (%s): try locking: %s ",         \               __FILE__,        __LINE__, G_STRFUNC,              \               #name), g_static_mutex_trylock (&G_LOCK_NAME (name)))#  else  /* !G_DEBUG_LOCKS */#    define G_LOCK(name) g_static_mutex_lock       (&G_LOCK_NAME (name))#    define G_UNLOCK(name) g_static_mutex_unlock   (&G_LOCK_NAME (name))#    define G_TRYLOCK(name) g_static_mutex_trylock (&G_LOCK_NAME (name))#  endif /* !G_DEBUG_LOCKS */#else   /* !G_THREADS_ENABLED */#  define G_LOCK_DEFINE_STATIC(name)    extern void glib_dummy_decl (void)#  define G_LOCK_DEFINE(name)           extern void glib_dummy_decl (void)#  define G_LOCK_EXTERN(name)           extern void glib_dummy_decl (void)#  define G_LOCK(name)#  define G_UNLOCK(name)#  define G_TRYLOCK(name)               (TRUE)#endif  /* !G_THREADS_ENABLED */G_END_DECLS#endif /* __G_THREAD_H__ */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -