📄 counter.java
字号:
package sample;/** * @File: Counter.java * @Description: Thread Test for CMPP2.0, successful or failed counts * @Copyright: Copyright 2002 By AsiaInfo(c) ISMG. All right reserved * @Date: 2002-10-24 * @Version 1.0 *//** * action counter */public class Counter{ public static int ciSendSuccess=0; public static int ciSendFail=0; public static int ciRecvSuccess=0; public static int ciRecvFail=0; /** * MT sent counts, synchronized method */ public synchronized static void SendAdd(int aiErrorCode) { //this following code can not be compiled in java, but works well in c/c++ //(aiErrorCode == 0)? ciSendSuccess++ : ciSendFail++ ; if ( aiErrorCode == 0 ) { ciSendSuccess ++ ; } else { ciSendFail ++ ; } } //end SendAdd ( int ) /** * MO received counts, synchronized method */ public synchronized static void RecvAdd(int aiErrorCode) { //(aiErrorCode == 0)? ciRecvSuccess++ : ciRecvFail++ ; if ( aiErrorCode == 0 ) { ciRecvSuccess ++ ; } else { ciRecvFail ++ ; } } //end RecvAdd ( int )}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -