[英]Calling synchronized(this) inside thread
I'm learning concurrent programming and wondering if I can call synchronized(this) on a part of a code inside threads.我正在学习并发编程,想知道是否可以在线程内的一部分代码上调用sync(this)。
I have one method which is running concurrently multiple times and I need to write to a file.我有一种方法可以同时运行多次,并且需要写入文件。 Can I use synchronize inside the method?
我可以在方法内部使用同步吗?
I'm learning concurrent programming and wondering if I can call synchronized(this) on a part of a code inside threads.我正在学习并发编程,想知道是否可以在线程内的一部分代码上调用sync(this)。
I have one method which is running concurrently multiple times and I need to write to a file.我有一种方法可以同时运行多次,并且需要写入文件。 Can I use synchronize inside the method?
我可以在方法内部使用同步吗?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.