1

There are two functions to be used as the entry point for a CMP desktop application:

fun usage
application() fun main() = application { ... }
awaitApplication() suspend fun main() = awaitApplication { ... }

Specifically, what is the difference between application(exitProcessOnExit = false) {...} and awaitApplication {...}

What is the use case for awaitApplication()?

1 Answer 1

2
application()

A high-level function.

Automatically starts the Compose event loop.

You define your UI (e.g., Window {}) inside the block.

The app exits automatically when all windows are closed.

Ideal for simple apps.

awaitApplication()

A suspend function — gives more control over the app lifecycle.

You need to manually call exitApplication() to terminate the app.

Useful when you need to suspend main(), perform async setup, or manage multiple windows manually.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.