class ThreadSafeClass extends Thread
{
private static int count = 0;
public synchronized static void increment()
{
count++;
}
public synchronized void decrement()
{
count--;
}
}
Run Code Online (Sandbox Code Playgroud)
谁能解释为什么上面的类不是线程安全的?
我正在使用PyGTK开发我正在开发的小应用程序.通过代理使用URLlib2将冻结我的GUI.反正有没有阻止它?
实际完成工作的代码是与GUI分开的,所以我想可能正在使用subprocess来调用python文件.但是,如果我要将应用程序转换为exe文件,那该怎么办?
谢谢