zoukankan      html  css  js  c++  java
  • 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

     

  • 相关阅读:
    [CSS] Showing horizontal scrollbar always for the table
    [Angular Unit Testing] Testing Component methods
    [Angular Unit Testing] Testing Services with dependencies
    Win7下unetbootin-windows-585工具制作Ubuntu12.04 U盘启动盘
    一个外行谈移动互联网产品的生与死
    unity 距离某天还有多久
    UI线程与worker线程
    关于 unity3d securityexception no valid crossdomain policy available 的错误解决方法
    小窍门:变更Windows Azure Websites自带的node.exe版本
    Windows SVN变更发送邮件通知(JAVA实现)
  • 原文地址:https://www.cnblogs.com/LubinLew/p/GLIB-g_thread_init.html
Copyright © 2011-2022 走看看