码迷,mamicode.com
首页 >  
搜索关键字:hierarchical mutex    ( 1231个结果
利用条件信号量设计读写锁
1 一个资源同时可以有多个读写,但是只能有一个写锁2 用flag代表锁的状态,#define un_lock 0#define r_lock1 //上一把读锁加一个r_lock#define w_lock -1伪代码1 LOCK_Rpthread_lock(resource.mutex)while(...
分类:其他好文   时间:2014-10-19 12:51:23    阅读次数:150
条件变量函数
#include #include #include pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;/*初始化互斥锁*/pthread_cond_t cond = PTHREAD_COND_INITIALIZER;/*初始化条件变量*/void ...
分类:其他好文   时间:2014-10-17 01:56:53    阅读次数:509
互斥量函数
一、互斥锁互斥锁,是一种信号量,常用来防止两个进程或线程在同一时刻访问相同的共享资源。需要的头文件:pthread.h互斥锁标识符:pthread_mutex_t(1)互斥锁初始化:函数原型: int pthread_mutex_init (pthread_mutex_t* mutex,const ...
分类:其他好文   时间:2014-10-17 00:50:53    阅读次数:246
【多线程】学习6
以下内容来自:http://blog.csdn.net/morewindows/article/details/7470936前面介绍了关键段CS、事件Event在经典线程同步问题中的使用。本篇介绍用互斥量Mutex来解决这个问题。互斥量也是一个内核对象,它用来确保一个线程独占一个资源的访问。互斥量...
分类:编程语言   时间:2014-10-16 23:23:13    阅读次数:336
ZOJ 3826 Hierarchical Notation 模拟
模拟: 文法分析 hash每个Key建图,对每个节点记录在原串的第几个位置开始输出。。。。 对每个询问沿图走就可以了。。。。 Hierarchical Notation Time Limit: 2 Seconds      Memory Limit: 131072 KB In Marjar University, students in College of Co...
分类:其他好文   时间:2014-10-15 14:24:21    阅读次数:184
改变eclipse工程中代码的层次结构
1. 代码的层次结构 一般之代码包(package)结构 有两种:扁平结构和继承两种。 扁平结构(flat)如下图所示:继承结构(hierarchical)2. 如何修改: 1. 选中package explorer右边的倒三角,如图所示2. 选中package presentation选项,选.....
分类:系统相关   时间:2014-10-15 12:47:10    阅读次数:199
多线程网页爬虫 python 实现(二)
#!/usr/bin/env python#coding=utf-8import threadingimport urllibimport reimport timecur=0last=0totalcount=0depth=0t_mutex=threading.Condition() class M...
分类:编程语言   时间:2014-10-15 00:21:09    阅读次数:297
多线程(C++)临界区Critical Sections
一 、Critical Sections(功能与Mutex相同,保证某一时刻只有一个线程能够访问共享资源,但是不是内核对象,所以访问速度比Mutex快,但是没有等待超时的功能,所以有可能导致死锁,使用要小心) 当多个线程访问一个独占性共享资源时,可以使用“临界区”对象。任一时刻只有一个线程可以拥有临...
分类:编程语言   时间:2014-10-14 17:42:28    阅读次数:160
zoj3826 Hierarchical Notation (字符串模拟)
Hierarchical NotationTime Limit:2 Seconds Memory Limit:131072 KBIn Marjar University, students in College of Computer Science will learn EON (Edward O...
分类:其他好文   时间:2014-10-14 01:09:07    阅读次数:406
数据共享之互斥量mutex
在看《Cplusplus Concurrency in Action Practical Multithreading》。记录一下学习过程,这是第三章关于线程互斥量的部分。...
分类:其他好文   时间:2014-10-14 00:58:17    阅读次数:362
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!