假设多个线程共享一个静态变量,如果让每个线程都执行相同的方法每次让静态变量自增1,这样的做法线程安全吗?能保证自增变量数据同步吗?本篇体验使用lock语句块和Interlocked类型方法保证自增变量的数据同步。 □ 线程不安全、数据不同步的做法 class Program { static int...
分类:
编程语言 时间:
2014-09-23 17:11:54
阅读次数:
243
/*TRUNC(number,num_digits)Number 需要截尾取整的数字。Num_digits 用于指定取整精度的数字。Num_digits 的默认值为 0。TRUNC()函数截取时不进行四舍五入*/--Oracle trunc()函数的用法/**************日期******...
分类:
数据库 时间:
2014-09-23 14:23:24
阅读次数:
191
svn服务器死机重启之后,锁定文件的时候出下面的提示:
Malformed file
svn: Can't parse lock/entries hashfile '/data/svn/svnroot/platform/db/locks/550/550529f7a3d790f5f7adeee3d408826e'
svn: Malformed file
搜索解决办法,没有找到中文资料,后...
分类:
其他好文 时间:
2014-09-23 13:16:04
阅读次数:
486
需要配置清单文件:也可以参考我之前写的这篇文章:http://blog.csdn.net/aikongmeng/article/details/39232017package com.example.wakeup;import android.annotation.SuppressLint;impo...
分类:
移动开发 时间:
2014-09-23 02:19:23
阅读次数:
266
http://poj.org/problem?id=1099#include#include#include using namespace std;#define N 60int x,y,n;char mat[N][N];struct node{ int num,id; int han...
分类:
其他好文 时间:
2014-09-22 23:15:03
阅读次数:
300
#include struct { int num; char name[10]; char sex; char job; union { int class1; char position[10]; } category; } p[2];void main() { int i,n; for(i =...
分类:
其他好文 时间:
2014-09-22 22:17:23
阅读次数:
186
mount = $mount;
}
public function getAmount(){
return $this -> mount;
}
public function add($num...
分类:
Web程序 时间:
2014-09-22 22:04:03
阅读次数:
243
我的是ubuntu 13.10
当时是中断了软件安装,然后出现了“无法获得锁”巴拉巴拉。。
解决方法 终端中输入
强制解锁命令
sudo rm /var/cache/apt/archives/lock
sudo rm /var/lib/dpkg/lock...
分类:
其他好文 时间:
2014-09-22 21:41:33
阅读次数:
144
1. 安装ftp服务 sudo apt-get install vsftpdCould not get lock /var/lib/dpkg/lock - open (11: Resource temporarily unavailable) 问题解决出现这个问题的原因可能是有另外一个程序正在运行,...
分类:
其他好文 时间:
2014-09-22 18:25:22
阅读次数:
151
protected void Button1_Click(object sender, EventArgs e) { if (Regex.IsMatch(TextBox1.Text.Trim(), @"^\d{7,11}$")) { string num = TextBox1.Text.Trim()...
分类:
移动开发 时间:
2014-09-22 13:45:22
阅读次数:
177