摘要
Java 语言提供了多线程编程技术,利用 Java 语言可以方便地实现多任务并行工作的功能。但是,由于线程会导致程序的异步行为,因此,有必要提供一种方法在需要时实现同步。通常是在被调用的方法前加上 Synchronized 关键字,就可以阻止其他线程竞用,直到一个线程执行完动作为止。从而避免了线程在运行时所产生的混乱状态,使其有序运行,实现线程同步。
Java language offers the thread programming technology.By using java language,the running function of multitask side by side can be conveniently realized.Because the thread will cause the synchronism about the procedure,it is necessary to offer a method that can realize the synchronism.Usually,the key word “synchronized” is added before the method that is transferred.So it can pre vent other thread in using simultaneously until the end of a thread.Therefore,it can avoid confused states that are produced while the thread if running,and make the thread go on in order,and realize its synchronism.
出处
《辽宁工程技术大学学报(自然科学版)》
CAS
北大核心
2004年第z1期196-197,共2页
Journal of Liaoning Technical University (Natural Science)