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 ...
随机推荐
- 分析web.xml
<?xml version="1.0" encoding="UTF-8"?> //xml的版本:1.0 和 编码:utf-8 <web-ap ...
- 阿里云OSS的Bucket容量大小采集
#!/usr/bin/env python3 #-*- coding: utf-8 -*- # 获取阿里云云监控中 OSS 中的bucket 的bucket大小 from aliyunsdkcore. ...
- java连接jdbc
package com.dy.util; import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLE ...
- HDU-1398 Square Coins(生成函数)
题意 与$hdu1028$类似,只不过可用的数字都是平方数. 思路 类似的思路,注意下细节. 代码 #include <bits/stdc++.h> #define DBG(x) cerr ...
- 不同IDE对maven项目静态资源处理
今天自己构建maven管理的web项目,参照另一位兄弟的代码,发现他的静态资源,也就是html.js之类的文件是在src/main/resource目录下的,我的在src/main/resource目 ...
- external与static的用法
一.extern是C/C++语言中表明函数和全局变量作用范围(可见性)的关键字:它告诉编译器,其声明的函数和变量可以在本函数文件或其它函数文件中使用. 1.对于extern变量来说,仅仅是一个变量的声 ...
- 2018-2019 网络对抗技术 20165231 Exp4 恶意代码分析
实验目标 1.是监控你自己系统的运行状态,看有没有可疑的程序在运行. 2.是分析一个恶意软件,就分析Exp2或Exp3中生成后门软件:分析工具尽量使用原生指令或sysinternals,systrac ...
- Revit二次开发封装族的替代方法
使用草图平面:
- 蓝盾杯writeup
由于比赛时只给了内网,web题目无法复现,这里就简单写一下misc的部分题目 1.眼花了吗 (默默吐槽居然是来自实验吧的原题) 提示:当眼花的时候会显示两张图,可以想到应该是包含双图的情况 用fore ...
- LightOJ 1348 (树链剖分 + 线段树(树状数组))
题目 Link 分析 典型的树链剖分题, 树链剖分学习资料 Code #include <bits/stdc++.h> using namespace std; const int max ...