Tcl\_CreateCloseHandler(3) Tcl Library Procedures Tcl\_CreateCloseHandler(3)

```

```

# [NAME](#NAME)

Tcl\_CreateCloseHandler, Tcl\_DeleteCloseHandler - arrange for callbacks when channels are closed

# [SYNOPSIS](#SYNOPSIS)

```
#include <tcl.h>

Tcl_CreateCloseHandler(channel, proc, clientData)

Tcl_DeleteCloseHandler(channel, proc, clientData)
```

# [ARGUMENTS](#ARGUMENTS)

Tcl\_Channel *channel* (in)

The channel for which to create or delete a close callback.

Tcl\_CloseProc *\*proc* (in)

The procedure to call as the callback.

void *\*clientData* (in)

Arbitrary one-word value to pass to *proc*.

```
    
```

# [DESCRIPTION](#DESCRIPTION)

**Tcl\_CreateCloseHandler** arranges for *proc* to be called when *channel* is closed with **Tcl\_Close** or **Tcl\_UnregisterChannel**, or using the Tcl **close** command. *Proc* should match the following prototype:

```
typedef void Tcl_CloseProc(


        void *clientData);
```

The *clientData* is the same as the value provided in the call to **Tcl\_CreateCloseHandler**.

**Tcl\_DeleteCloseHandler** removes a close callback for *channel*. The *proc* and *clientData* identify which close callback to remove; **Tcl\_DeleteCloseHandler** does nothing if its *proc* and *clientData* arguments do not match the *proc* and *clientData* for a close handler for *channel*.

# [SEE ALSO](#SEE_ALSO)

[close(n)](/man/os/tcl/close.n), [Tcl\_Close(3)](/man/os/tcl/Tcl_Close.3), [Tcl\_UnregisterChannel(3)](/man/os/tcl/Tcl_UnregisterChannel.3)

# [KEYWORDS](#KEYWORDS)

callback, channel closing

7.5 Tcl

---

Document: Tcl_DeleteCloseHandler(3) from tcl 9.1.0-r0 (Chainguard OS)
Source: https://downloads.sourceforge.net/project/tcl/Tcl/9.1.0/tcl9.1.0-src.tar.gz
