Stay organized with collections
Save and categorize content based on your preferences.
State
class State
A thread state. A thread can be in one of the following states:
NEW
A thread that has not yet started is in this state.
RUNNABLE
A thread executing in the Java virtual machine is in this state.
BLOCKED
A thread that is blocked waiting for a monitor lock is in this state.
WAITING
A thread that is waiting indefinitely for another thread to perform a particular action is in this state.
TIMED_WAITING
A thread that is waiting for another thread to perform an action for up to a specified waiting time is in this state.
TERMINATED
A thread that has exited is in this state.
A thread can be in only one state at a given point in time. These states are virtual machine states which do not reflect any operating system thread states.
Summary
Enum values |
Thread state for a thread blocked waiting for a monitor lock.
|
Thread state for a thread which has not yet started.
|
Thread state for a runnable thread.
|
Thread state for a terminated thread.
|
Thread state for a waiting thread with a specified waiting time.
|
Thread state for a waiting thread.
|
Enum values
BLOCKED
enum val BLOCKED : Thread.State
Thread state for a thread blocked waiting for a monitor lock. A thread in the blocked state is waiting for a monitor lock to enter a synchronized block/method or reenter a synchronized block/method after calling Object.wait
.
NEW
enum val NEW : Thread.State
Thread state for a thread which has not yet started.
RUNNABLE
enum val RUNNABLE : Thread.State
Thread state for a runnable thread. A thread in the runnable state is executing in the Java virtual machine but it may be waiting for other resources from the operating system such as processor.
TERMINATED
enum val TERMINATED : Thread.State
Thread state for a terminated thread. The thread has completed execution.
TIMED_WAITING
enum val TIMED_WAITING : Thread.State
Thread state for a waiting thread with a specified waiting time. A thread is in the timed waiting state due to calling one of the following methods with a specified positive waiting time:
- sleep
Object.wait
with timeout
Thread.join
with timeout
- java.util.concurrent.locks.LockSupport#parkNanos
- java.util.concurrent.locks.LockSupport#parkUntil
WAITING
enum val WAITING : Thread.State
Thread state for a waiting thread. A thread is in the waiting state due to calling one of the following methods:
A thread in the waiting state is waiting for another thread to perform a particular action. For example, a thread that has called Object.wait()
on an object is waiting for another thread to call Object.notify()
or Object.notifyAll()
on that object. A thread that has called Thread.join()
is waiting for a specified thread to terminate.
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-02-10 UTC."],[],[],null,["# Thread.State\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nState\n=====\n\n```\nclass State\n```\n\n|---|---|-----------------------------|\n| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html) |||\n| ↳ | [kotlin.Enum](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-enum/index.html)\\\u003c[java.lang.Thread.State](#)\\\u003e ||\n| | ↳ | [java.lang.Thread.State](#) |\n\n|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Known Direct Subclasses [Thread.State.BLOCKED](#ENUM_VALUE:BLOCKED), [Thread.State.NEW](#ENUM_VALUE:NEW), [Thread.State.RUNNABLE](#ENUM_VALUE:RUNNABLE), [Thread.State.TERMINATED](#ENUM_VALUE:TERMINATED), [Thread.State.TIMED_WAITING](#ENUM_VALUE:TIMED_WAITING), [Thread.State.WAITING](#ENUM_VALUE:WAITING) |---------------------------------------------------------|------------------------------------------------------------------| | [Thread.State.BLOCKED](#ENUM_VALUE:BLOCKED) | Thread state for a thread blocked waiting for a monitor lock. | | [Thread.State.NEW](#ENUM_VALUE:NEW) | Thread state for a thread which has not yet started. | | [Thread.State.RUNNABLE](#ENUM_VALUE:RUNNABLE) | Thread state for a runnable thread. | | [Thread.State.TERMINATED](#ENUM_VALUE:TERMINATED) | Thread state for a terminated thread. | | [Thread.State.TIMED_WAITING](#ENUM_VALUE:TIMED_WAITING) | Thread state for a waiting thread with a specified waiting time. | | [Thread.State.WAITING](#ENUM_VALUE:WAITING) | Thread state for a waiting thread. | |\n\nA thread state. A thread can be in one of the following states:\n\n- [NEW](#) \n A thread that has not yet started is in this state.\n- [RUNNABLE](#) \n A thread executing in the Java virtual machine is in this state.\n- [BLOCKED](#) \n A thread that is blocked waiting for a monitor lock is in this state.\n- [WAITING](#) \n A thread that is waiting indefinitely for another thread to perform a particular action is in this state.\n- [TIMED_WAITING](#) \n A thread that is waiting for another thread to perform an action for up to a specified waiting time is in this state.\n- [TERMINATED](#) \n A thread that has exited is in this state.\n\n\u003cbr /\u003e\n\nA thread can be in only one state at a given point in time. These states are virtual machine states which do not reflect any operating system thread states.\n\nSummary\n-------\n\n| Enum values ||\n|-------------------------------------------------------------------------------------------------------------|---|\n| [BLOCKED](#ENUM_VALUE:BLOCKED) Thread state for a thread blocked waiting for a monitor lock. |\n| [NEW](#ENUM_VALUE:NEW) Thread state for a thread which has not yet started. |\n| [RUNNABLE](#ENUM_VALUE:RUNNABLE) Thread state for a runnable thread. |\n| [TERMINATED](#ENUM_VALUE:TERMINATED) Thread state for a terminated thread. |\n| [TIMED_WAITING](#ENUM_VALUE:TIMED_WAITING) Thread state for a waiting thread with a specified waiting time. |\n| [WAITING](#ENUM_VALUE:WAITING) Thread state for a waiting thread. |\n\nEnum values\n-----------\n\n### BLOCKED\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nenum val BLOCKED : Thread.State\n```\n\nThread state for a thread blocked waiting for a monitor lock. A thread in the blocked state is waiting for a monitor lock to enter a synchronized block/method or reenter a synchronized block/method after calling [Object.wait](/reference/kotlin/java/lang/Object#wait()). \n\n### NEW\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nenum val NEW : Thread.State\n```\n\nThread state for a thread which has not yet started. \n\n### RUNNABLE\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nenum val RUNNABLE : Thread.State\n```\n\nThread state for a runnable thread. A thread in the runnable state is executing in the Java virtual machine but it may be waiting for other resources from the operating system such as processor. \n\n### TERMINATED\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nenum val TERMINATED : Thread.State\n```\n\nThread state for a terminated thread. The thread has completed execution. \n\n### TIMED_WAITING\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nenum val TIMED_WAITING : Thread.State\n```\n\nThread state for a waiting thread with a specified waiting time. A thread is in the timed waiting state due to calling one of the following methods with a specified positive waiting time:\n\n- sleep\n- [Object.wait](/reference/kotlin/java/lang/Object#wait(kotlin.Long)) with timeout\n- [Thread.join](/reference/kotlin/java/lang/Thread#join(kotlin.Long)) with timeout\n- java.util.concurrent.locks.LockSupport#parkNanos\n- java.util.concurrent.locks.LockSupport#parkUntil\n\n\u003cbr /\u003e\n\n### WAITING\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nenum val WAITING : Thread.State\n```\n\nThread state for a waiting thread. A thread is in the waiting state due to calling one of the following methods:\n\n- [Object.wait](/reference/kotlin/java/lang/Object#wait()) with no timeout\n- [Thread.join](/reference/kotlin/java/lang/Thread#join()) with no timeout\n- [LockSupport.park](../util/concurrent/locks/LockSupport.html#park())\n\n\u003cbr /\u003e\n\nA thread in the waiting state is waiting for another thread to perform a particular action. For example, a thread that has called `Object.wait()` on an object is waiting for another thread to call `Object.notify()` or `Object.notifyAll()` on that object. A thread that has called `Thread.join()` is waiting for a specified thread to terminate."]]