diff --git a/topics/basics/architectural_overview/threading/execution_contexts.topic b/topics/basics/architectural_overview/threading/execution_contexts.topic index ab481c8ca..054cd09f5 100644 --- a/topics/basics/architectural_overview/threading/execution_contexts.topic +++ b/topics/basics/architectural_overview/threading/execution_contexts.topic @@ -5,7 +5,7 @@ xsi:noNamespaceSchemaLocation="https://resources.jetbrains.com/writerside/1.0/topic.v2.xsd" id="execution_contexts" title="Execution Contexts"> - Execution Contexts + Execution Contexts Tracking execution progress, checking for cancellations, and switching between different execution contexts.

The IntelliJ Platform provides APIs that allow tracking the progress of background processes and canceling their @@ -25,14 +25,19 @@

  • — obsolete since 2024.1
  • -

    Currently, the Progress Indicator context is the most widely used approach in the IntelliJ Platform. - As the platform's execution model moves towards coroutines, this approach - can be considered obsolete.

    + +

    Currently, the Progress Indicator context is the most widely used approach in the IntelliJ Platform. + As the platform's execution model moves towards coroutines, this approach + can be considered obsolete.

    +

    Starting with 2024.2, it is recommended to execute new code in the .

    -

    The following sections explain the contexts and provide information about process cancellation, progress - tracking, and switching between contexts.

    + +

    The following sections explain the contexts and provide information about process cancellation, progress + tracking, and switching between contexts.

    +
    + @@ -72,16 +77,12 @@
  • — obsolete since 2024.1
  • - - - +

    Starting with 2024.1, it is recommended to execute new code in the Suspending Context.

    - - - + @@ -128,7 +129,6 @@ -

    Code executed via the Progress API @@ -145,6 +145,7 @@ performant solution.

    +

    The following table presents APIs to use for checking whether a task was canceled in different execution @@ -169,17 +170,19 @@ - - Progress Indicator - - -

  • - ProgressIndicator.checkCanceled()
  • -
  • - ProgressManager.checkCanceled()
  • - - - + + + Progress Indicator + + +
  • + ProgressIndicator.checkCanceled()
  • +
  • + ProgressManager.checkCanceled()
  • +
    + + +
    @@ -210,9 +213,7 @@ - - - + @@ -227,58 +228,60 @@ - - - - - + + + + + + + + +
    Coroutine Execution Context - -
  • ProgressStep - - a step-based progress reporting (see its KDoc for details) -
  • -
  • RawProgressReporter - - a raw text, details, and fraction reporting (invoked via reportRawProgress()) -
  • -
    -

    - Any report*Progress() - function must be used inside withBackgroundProgress(), withModalProgress(), - or runWithModalProgressBlocking() from - tasks.kt - . - Otherwise, if there is no reporter in the context, using report*Progress() will - have no effect. - Example: -

    - - withBackgroundProgress(...) { // or other - // ... - reportProgress { reporter -> // or another report*Progress - // do tasks and report progress + +
    + +
  • ProgressStep + - a step-based progress reporting (see its KDoc for details) +
  • +
  • RawProgressReporter + - a raw text, details, and fraction reporting (invoked via reportRawProgress()) +
  • +
    +

    + Any report*Progress() + function must be used inside withBackgroundProgress(), withModalProgress(), + or runWithModalProgressBlocking() from + tasks.kt + . + Otherwise, if there is no reporter in the context, using report*Progress() will + have no effect. + Example: +

    + + withBackgroundProgress(...) { // or other + // ... + reportProgress { reporter -> // or another report*Progress + // do tasks and report progress + } + // ... } - // ... - } - -
    Progress Indicator - ProgressIndicator's - or ProgressManager's - methods -

    See Background Processes: Tracking - Progress for details.

    -
    Progress Indicator + ProgressIndicator's + or ProgressManager's + methods +

    See Background Processes: Tracking + Progress for details.

    +
    - - - + @@ -286,9 +289,7 @@ unavailable - - - +
    Suspending Context
    Blocking Context