- Category:
- Other systems
- Tags:
-
- File Size:
- 3kb
- Update:
- 2017-12-17
- Downloads:
- 0 Times
- Uploaded by:
- Serena
Description: 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.
To Search:
File list (Check if you may need any files):
Filename | Size | Date |
---|
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 |