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
g_thread_init的更多相关文章
- 【转】gtk+多线程的程序实例
#include <gtk/gtk.h> gint test() { while(1) { gdk_threads_enter(); g_printf("hello\n" ...
- botbrew下写glib2程序
作者 He YiJun – storysnail<at>gmail.com 团队 ls 版权 转载请保留本声明! 本文档包含的原创代码根据General Public License,v3 ...
- C++ 用libcurl库进行http通讯网络编程
使用libcurl完成http通讯,很方便而且是线程安全,转载一篇比较好的入门文章 转载自 http://www.cnblogs.com/moodlxs/archive/2012/10/15/2724 ...
- C++ 用libcurl库进行http通讯网络编程(转)
转载:http://www.cnblogs.com/moodlxs/archive/2012/10/15/2724318.html 目录索引: 一.LibCurl基本编程框架 二.一些基本的函数 三. ...
- 2.1 LibCurl编程流程(转)
转载地址:http://blog.chinaunix.net/u/17660/showart_1822514.html2 LibCurl编程2.1 LibCurl编程流程在基于LibCurl的程序里, ...
- libcurl
一.LibCurl基本编程框架 二.一些基本的函数 三.curl_easy_setopt函数部分选项介绍 四.curl_easy_perform 函数说明(error 状态码) 五.libcurl使用 ...
- libcurl编程学习
一.curl简介 curl是一个利用URL语法在命令行方式下工作的文件传输工具.它支持的协议有:FTP, FTPS, HTTP, HTTPS, GOPHER, TELNET, DICT, FILE 以 ...
- LibCurl编程手册以及代码实例
1. LibCurl编程流程 在基于LibCurl的程序里,主要采用callback function (回调函数)的形式完成传输任务,用户在启动传输前设置好各类参数和回调函数,当满足条件时libcu ...
- C++ 用libcurl库进行http通讯网络编程[转]
http://www.cnblogs.com/moodlxs/archive/2012/10/15/2724318.html 目录索引: 一.LibCurl基本编程框架 二.一些基本的函数 三.cur ...
随机推荐
- Intellij IDEA 14中使用MyBatis-generator 自动生成MyBatis代码
一:项目建立好及其基本的测试好 二:在maven项目的pom.xml 添加mybatis-generator-maven-plugin 插件 <build> <finalName&g ...
- 【tensorflow】学习笔记
1.tensorflow中dynamic_rnn和rnn有什么区别? 在tensorflow中没有找到rnn这个方法难道是废弃掉了? rnn是静态图,比如有10个时间序列,那么它将全部展开,并且 ...
- Mybatis插件机制以及PageHelper插件的原理
首先现在已经有很多Mybatis源码分析的文章,之所以重复造轮子,只是为了督促自己更好的理解源码. 1.先看一段PageHelper拦截器的配置,在mybatis的配置文件<configurat ...
- 【C#】 List按指定字段的给出的自定义顺序进行排序
#引言 有一个集合,对其进行排序,排序规则为:按对象中某个字段的特定顺序进行排序,比如:对象属性id,按照[4,2,5,1]的顺序排序: #代码: public class Foo { public ...
- DirectX11--深入理解与使用2D纹理资源
前言 写教程到现在,我发现有关纹理资源的一些解说和应用都写的太过分散,导致连我自己找起来都不方便.现在决定把这部分的内容整合起来,尽可能做到一篇搞定所有2D纹理相关的内容,其中包括: DDSTextu ...
- mockplus 原型设计工具
国产原型工具 http://www.mockplus.cn, 该工具功能很棒. 每次打开软件都需先登陆, 好在项目文件是可以保存到本地, 可以注册为免费版/个人版/团队版/企业版. 我是免费账号, 功 ...
- DataTable某一列转换为分隔字符串
//把DataTable的某一列转化为逗号分隔字符串 private static string DataTableColumnSplit(DataTable dataTable,string str ...
- PHP代码审计之XSS操作
XSS XSS是Cross Site Scripting(跨站脚本攻击), 它与sql注入攻击类似,SQL注入攻击中以SQL语句作为用户输入,从而达到查询/修改/删除的目的,而在XSS攻击中,通过插入 ...
- python3 练手实例4 九九乘法口诀表
for i in range(1,10): for j in range(1,i+1): print('{}*{}={}\t'.format(i,j,i*j),end='') print()
- Linux系统GNOME主题安装与Tweaks工具使用
需要软件: GNOME Tweaks--使主题修改更加容易一个工具 安装主题: 下载主题:mac themes下载链接:https://www.gnome-look.org/p/1241688/ 这里 ...