文件名称:1
- 所属分类:
- 其他小程序
- 资源属性:
- 上传时间:
- 2017-12-17
- 文件大小:
- 3kb
- 下载次数:
- 0次
- 提 供 者:
- 86232*****
- 相关连接:
- 无
- 下载说明:
- 别用迅雷下载,失败请重下,重下不扣分!
介绍说明--下载内容均来自于网络,请自行研究使用
线程互斥。在 main函数中创建一新线程,然后main线程和这个新线程共享同一变量,如 sum。在 main函数中,编写一个循环语句共循环 20 次,在每循环中先把sum的值加 1,然后休眠1毫秒。在新线程中,也 毫秒。在新线程中,也编写一个循环语句,总共循环20 次,在每次循环中先把sum 赋值给一个临时变量t,然后把 t加 1,然后休眠 1毫秒,最后把 t的值赋给sum 。当上述工作全部完成后,在main函数中打印sum的值。(Thread mutual exclusion. Create a new thread in the main function, and then the main thread shares the same variable with the new thread, such as sum. In the main function, a loop statement is written in a total cycle of 20 times, and the value of the sum is first added to 1 in each loop and then dormant for 1 milliseconds. In the new thread, also milliseconds. In the new thread, a circular statement is also written, which has 20 cycles altogether. In each cycle, assign sum to a temporary variable t first, then add t to 1, then sleep 1 milliseconds, and finally assign the value of t to sum. When all of the work is done, the value of the sum is printed in the main function.)
相关搜索: 混乱的加法
(系统自动生成,下载前可以参看下载内容)
下载文件列表
文件名 | 大小 | 更新时间 |
---|---|---|
1\1\.classpath | 301 | 2017-10-12 |
1\1\.project | 387 | 2017-10-12 |
1\1\.settings\org.eclipse.jdt.core.prefs | 598 | 2017-10-12 |
1\1\bin\chaoticsum\ChaoticSum.class | 945 | 2017-12-17 |
1\1\bin\chaoticsum\Data.class | 327 | 2017-12-17 |
1\1\bin\chaoticsum\SpeakThread.class | 676 | 2017-12-17 |
1\1\src\chaoticsum\ChaoticSum.java | 639 | 2017-12-17 |
1\1\bin\chaoticsum | ||
1\1\src\chaoticsum | ||
1\1\.settings | ||
1\1\bin | ||
1\1\src | ||
1\1 | ||
1 |