Home > Java > javaTutorial > What is the status of java thread execution?

What is the status of java thread execution?

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2023-04-18 09:55:02
forward
1014 people have browsed it

1. If the queue is full, the new thread performing the put operation will be added to the notFull condition queue to wait.

2. The queue is not full. When a thread performs the operation of removing queue elements, the removal is successful and the put thread is awakened.

Example

    public E take() throws InterruptedException {
        final ReentrantLock lock = this.lock;
        lock.lockInterruptibly();
        try {
            // 队列长度为0
            while (count == 0)
                // 阻塞
                notEmpty.await();
            // 如果队列有元素执行删除操作
            return dequeue();
        } finally {
            lock.unlock();
        }
    }
/** Condition for waiting takes */
    private final Condition notEmpty;
Copy after login

The above is the detailed content of What is the status of java thread execution?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
Install JAVA
From 1970-01-01 08:00:00
0
0
0
Unable to install java
From 1970-01-01 08:00:00
0
0
0
Can java be used as the backend of the web?
From 1970-01-01 08:00:00
0
0
0
Is this in Java language?
From 1970-01-01 08:00:00
0
0
0
Help: JAVA encrypted data PHP decryption
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template