废话少说,直接进入主题: 1.在类xppSource中增加一个类似的方法: eg. Source ifElse(Source _condition = '', Source _ifStatement = '', Source _elseStatement = '') { this.i...
分类:
其他好文 时间:
2015-09-09 11:17:24
阅读次数:
127
在看Condition之前,我们先来看下面这个例子:工厂类,用来存放、取出商品:public class Depot {
private int depotSize; //仓库大小
private Lock lock; //独占锁
public Depot(){
depotSize = 0;
lock = n...
分类:
编程语言 时间:
2015-09-06 13:06:31
阅读次数:
172
本文主要复习下基础知识:1.C#系统自带的特性: 建立一个控制台项目取名为AttributeTest:我们添加了一个系统自带的Attribute叫Condition,这个特性表示在程序的DEBUG状态下才可以运行方法,我们在DEBUG下运行可以正常输出:然后我们改为Release模式不会看到结果:我...
关于竞争冒险:1.use +race utility to locate race condition code ****2.use $vcdplusdeltacycleon to locate race condition code(不常用)3.use vcddiff & vcat t locat...
分类:
其他好文 时间:
2015-09-04 15:45:39
阅读次数:
155
mysql存储过程也提供了对异常处理的功能:通过定义HANDLER来完成异常声明的实现语法如下:DECLARE handler_type HANDLER FOR condition_value[,...] sp_statement handler_type: CONTINUE | EXIT cond...
分类:
数据库 时间:
2015-09-01 20:01:41
阅读次数:
361
原文链接:http://www.cnblogs.com/dolphin0520/p/3920385.html在前面我们将了很多关于同步的问题,然而在现实中,需要线程之间的协作。比如说最经典的生产者-消费者模型:当队列满时,生产者需要等待队列有空间才能继续往里面放入商品,而在等待的期间内,生产者必须释...
分类:
编程语言 时间:
2015-08-28 17:06:50
阅读次数:
212
之前有一节中,我们使用mutex实现了一个线程间安全的堆栈。这一节,我们使用条件变量来实现一个线程间安全的队列。
标准库中的std::queue
template >
class queue {
public:
explicit queue(const Container&);
explicit queue(Container&& = Container());
qu...
分类:
编程语言 时间:
2015-08-26 22:25:23
阅读次数:
529
lr_exit(LR_EXIT_ACTION_AND_CONTINUE, LR_AUTO); Exit without any condition, and go directly to end actionlr_exit(LR_EXIT_MAIN_ITERATION_AND_CONTINUE, L...
分类:
其他好文 时间:
2015-08-25 23:41:27
阅读次数:
556
1 // The standard idiom for calling the wait2 synchronized(sharedObject) {3 while(condition){4 sharedObject.wait();// Releases lock...
分类:
编程语言 时间:
2015-08-25 13:21:05
阅读次数:
266
今天得空继续扫了一下(https://computing.llnl.gov/tutorials/pthreads/,这次没有用c++,直接参考的tutorial中的c语言实现)pthread中提供的另一种线程同步的方法:condition variables既然已经有了mutex,为什么还要有con...
分类:
编程语言 时间:
2015-08-20 01:15:19
阅读次数:
328