Threading in Java: How to lock an object?

前端 未结 7 704
长发绾君心
长发绾君心 2020-12-29 03:33

The following Function is executing in its own thread:

private void doSendData()
{
    try {

           //writeToFile(); // just a temporary location of a c         


        
7条回答
  •  执念已碎
    2020-12-29 04:28

    I always cringe when I see this kind of code. Do yourself a favour and have a look at the java.util.concurrent package.

提交回复
热议问题