Object类中的wait(),notify()和notifyAll()可以实现线程的等待通知模型,同样在ReentrantLock中可以借助Condition来完成这种机制。本篇就简要介绍Condition的工作原理。 先看一下Condition的使用示例: 这段代码的输出为: 等待时间大概为10 ...
分类:
其他好文 时间:
2019-02-16 11:58:08
阅读次数:
161
"Weird Numbers" Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 594 Accepted Submission(s): 185 ...
分类:
其他好文 时间:
2019-02-15 19:53:27
阅读次数:
130
column_dic = {"id": 0, "name": 1, "age": 2, "phone": 3, "job": 4} def get_show_list(col_condition): # "select age,name" """ 获取要展示的列名 :param col_condit... ...
分类:
数据库 时间:
2019-02-15 17:30:59
阅读次数:
263
from selenium import webdriver from selenium.common.exceptions import NoSuchElementException from selenium.webdriver.common.by import By from selenium... ...
分类:
其他好文 时间:
2019-02-11 21:31:09
阅读次数:
260
Your car starts at position 0 and speed +1 on an infinite number line. (Your car can go into negative positions.) Your car drives automatically accord ...
分类:
其他好文 时间:
2019-02-11 00:59:54
阅读次数:
259
题目要求 Given an array A of non-negative integers, half of the integers in A are odd, and half of the integers are even. Sort the array so that whenever ...
分类:
其他好文 时间:
2019-02-09 10:30:54
阅读次数:
200
1. LockSupport简介 在之前介绍AQS的底层实现,已经在介绍java中的Lock时,比如ReentrantLock,ReentReadWriteLocks,已经在介绍线程间等待/通知机制使用的Condition时都会调用LockSupport.park()方法和LockSupport.u ...
分类:
其他好文 时间:
2019-02-08 20:06:51
阅读次数:
169
1.Condition简介 任何一个java对象都天然继承于Object类,在线程间实现通信的往往会应用到Object的几个方法,比如wait(),wait(long timeout),wait(long timeout, int nanos)与notify(),notifyAll()几个方法实现等 ...
分类:
其他好文 时间:
2019-02-08 20:03:50
阅读次数:
182
A. The King's Race 签. 1 #include <bits/stdc++.h> 2 using namespace std; 3 4 #define ll long long 5 ll n, x, y; 6 7 ll f(ll a, ll b) 8 { 9 return max(a ...
分类:
其他好文 时间:
2019-02-06 10:41:54
阅读次数:
233
这次主要围绕的是游戏AI该如何模仿人类地判断条件(condition)。 人类的逻辑 人类的逻辑思考是复杂的,模糊的。 一些人类逻辑思考的例子:“把面包切成中等厚度”,“这波我很强”,“你好骚啊”,“小A有点高”.... 而对于计算机,它只认识离散的数值: 假设在一个问题中,智商划分了3个集合:笨拙 ...
分类:
其他好文 时间:
2019-02-06 09:28:38
阅读次数:
233