我已经读过select和多线程编程是低性能IO模型,例如这篇关于高性能IO的IBM developerworks文章.
我不明白同步/异步如何:阻塞/非阻塞正在改善性能.为什么AIO是最佳选择?
我有一个C类,我已经重载了Normal,复制构造函数和赋值运算符来打印所调用的内容的痕迹.
我编写了以下代码来测试什么时候被调用?
C c1; --> Normal Constuctor .. // understood Fine
C c2;
c2 = c1; --> Normal constructor + assignment operator .. //understood Fine
C * c3 = new C(C1) --> Copy constructor // Understood Fine
C c4 = c1 --> copy constructor // Not Able to understand
Run Code Online (Sandbox Code Playgroud)
这似乎让我感到困惑,因为在这段代码中虽然我在声明时初始化,但它是通过赋值运算符而不是复制构造函数.我理解错了吗?
我有以下代码:
public Hashmap<String,String> tempmap = new HashMap<String,String>();
Run Code Online (Sandbox Code Playgroud)
和一个类功能:
void f1(){
synchronized(onClassVariable1){
....Some code onClassVariable1...
String tempString = tempMap.toString();
... Some work onClassVarible1 and tempString ...
}
}
Run Code Online (Sandbox Code Playgroud)
多线程通过此类的对象调用此函数f1.
这个函数是线程安全的吗?