Tcl_CreateCloseHandler(3)
β¨ Tcl_CreateCloseHandler β¨
okay bestie, we're looking at the Tcl Library Procedures page for Tcl_CreateCloseHandler and Tcl_DeleteCloseHandler β it's giving "set up callbacks for when channels get closed" and honestly? iconic. π
πΈ NAME πΈ
Tcl_CreateCloseHandler, Tcl_DeleteCloseHandler β arrange for callbacks when channels are closed π
π¦ SYNOPSIS π¦
#include <tcl.h>
Tcl_CreateCloseHandler(channel, proc, clientData)
Tcl_DeleteCloseHandler(channel, proc, clientData)
π ARGUMENTS π
Tcl_Channel channel(in) β the channel you wanna create or delete a close callback for, no cap π«ΆTcl_CloseProc *proc(in) β the procedure that gets called as the callback, literally the whole point β¨void *clientData(in) β an arbitrary one-word value you pass along toprocπ
π DESCRIPTION π
so here's the tea, bestie: Tcl_CreateCloseHandler arranges for proc to be called when channel is closed β and we mean closed with Tcl_Close or Tcl_UnregisterChannel, or by using the Tcl close command. π
Your proc should match this prototype, exactly, character for character:
typedef void Tcl_CloseProc(
void *clientData);
the clientData you get in there is the same value you handed over in the call to Tcl_CreateCloseHandler. same one, fr fr. π
Tcl_DeleteCloseHandler removes a close callback for channel. the proc and clientData together are what identify which close callback to remove β that's the vibe check that decides who gets yeeted. π
β οΈ heads up:Tcl_DeleteCloseHandlerdoes nothing if itsprocandclientDataarguments do not match theprocandclientDatafor a close handler forchannel. like, nothing nothing. it just stands there. π
π₯ SEE ALSO π₯
β KEYWORDS β
callback, channel closing
and that's the whole page, bestie β go forth and handle those closes π
this one's from the Tcl library docs, version 7.5, and the date stamp is 7.5 too, so yeah, it's been around a minute and it still ate. periodt. ππβ¨
π¦ where this page comes from
- alpine 3.23: tcl9-doc 9.0.3-r0 Β· TCL
- alpine 3.24: tcl9-doc 9.0.3-r2 Β· TCL
- fedora 43: tcl-doc 1:9.0.2-1.fc43 Β· TCL AND GPL-3.0-or-later WITH Bison-exception-2.2 AND BSD-3-Clause
- fedora 44: tcl-doc 1:9.0.2-1.fc44 Β· TCL AND GPL-3.0-or-later WITH Bison-exception-2.2 AND BSD-3-Clause
- nixos 26.05: tcl 9.0.3
- nixpkgs unstable: tcl 9.1.0
- Copyright (c) 1994-1996 Sun Microsystems, Inc
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms