---
name: "MainLoop"
section: "3tcl"
platform: "linux"
package: "tcl8.2-doc"
version: "8.2.3-9"
release: "Debian 3.0 (Woody)"
platforms: ["linux"]
url: "https://new.carta.tech/MainLoop/3tcl"
---

# MainLoop(3tcl)

loop for events until there is no more work to do.

```

```

## NAME

Tcl\_MainLoop - loop for events until there is no more work to do.

## SYNOPSIS

```
#include <tcl.h>

Tcl_MainLoop()
```

## DESCRIPTION

**Tcl\_MainLoop** is a procedure that loops repeatedly calling **Tcl\_DoOneEvent**.  It returns only when there is no work to be done any more (i.e. no main windows exist anymore).  Any application that consists entirely of callbacks invoked via **Tcl\_DoOneEvent** only has to call **Tcl\_MainLoop** after initialization. The notifier will take care that the application exits automatically when there is nothing to be done any more.

## KEYWORDS

application, event, main loop
