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

     

  • 相关阅读:
    vue 数字滚动的插件 vue-count-to
    ASP.NET Core EF 查询获取导航属性值,使用Include封装
    nginx在asp.net mvc项目中 配置 初步快速入门
    JQuery EasyUI 扩展方法 日期控件 设置时间段函数
    JQueryEasyUI easyui-combobox 单击文本区域显示下拉菜单
    Jquery Easy UI Datagrid 上下移动批量保存数据
    ASP.NET MVC BundleConfig介绍和使用
    ASP.NET MVC5 视图相关学习
    SqlDependency数据库同步+signalr 推送消息
    T4 模板自动生成带注释的实体类文件
  • 原文地址:https://www.cnblogs.com/LubinLew/p/GLIB-g_thread_init.html
Copyright © 2011-2022 走看看