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 ...
随机推荐
- noi.ac309 Mas的童年
题目链接 题面 题目描述 \(Mas\)完成了一天的工作,走在回家的路上,看着路边的景色,他想起来自己的童年. 许许多多的记忆交错,丝丝缕缕的牵扯着\(Mas\). 在回忆的深处,\(Mas\)想起来 ...
- 微信公众号开发之access_token的全局共用
最近做微信公众号开发,涉及到access_token的缓存问题(避免各自的应用都去取access_token,同时解决微信 appid和appsecret的安全问题),在通用权限管理系统底层增加了实现 ...
- 第四十六篇--解析和保存xml文件
新建assets资源文件夹,右键app --> new --> Folder --> Assets Folder,将info.xml放入此文件夹下面. info.xml <?x ...
- Exp4 恶意代码分析
一.原理与实践说明 1. 实践目标 1.1 监控你自己系统的运行状态,看有没有可疑的程序在运行. 1.2 分析一个恶意软件,就分析Exp2或Exp3中生成后门软件:分析工具尽量使用原生指令或sysin ...
- Helm包管理工具(简介、安装、方法)
认识Helm 每次我们要部署一个应用都需要写一个配置清单(维护一套yaml文件),但是每个环境又不一样.部署一套新的环境成本是真的很高.如果我们能够使用类似于yum的工具来安装我们的应用的话那就太好了 ...
- 07--STL序列容器(Array)
一:Array了解 array<T,N> 模板定义了一种相当于标准数组的容器类型.它是一个有 N 个 T 类型元素的固定序列.除了需要指定元素的类型和个数之外,它和常规数组没有太大的差别. ...
- 静态网站创建工具Docusaurus
地址:https://docusaurus.io/docs/zh-CN/installation 安装 Docusaurus
- 图解TCP/IP
序言 ----
- D. Vanya and Treasure Codeforces Round #355 (Div. 2)
http://codeforces.com/contest/677/problem/D 建颗新树,节点元素包含r.c.dis,第i层包含拥有编号为i的钥匙的所有节点.用i-1层更新i层,逐层更新到底层 ...
- 移动文件(git mv)
使用git mv命令将mian.c移动为main2.c $ git mv main.c main2.c D:\Git\test (master -> origin) $ git status O ...