TCL_CREATECLOSEHANDLER(3tcl)
π TCL_CREATECLOSEHANDLER π
okay bestie, so you're out here in the Tcl Library Procedures and you want to know what happens when a channel gets yeeted into the void. that's what Tcl_CreateCloseHandler and Tcl_DeleteCloseHandler are for. we're arranging callbacks for when channels are closed. it's giving cleanup crew energy. no cap.
β¨ 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 for which you wanna create or delete a close callback. like, which channel are we doing this to, bestie πTcl_CloseProc *proc(in) β the procedure that gets called as the callback. the actual function. the main character π«Άvoid *clientData(in) β arbitrary one-word value to pass toproc. literally just vibes you hand over so your function knows what's up β¨
π DESCRIPTION π
Tcl_CreateCloseHandler</p> arranges for proc to be called when channel is closed with Tcl_Close or Tcl_UnregisterChannel, or using the Tcl close command. so basically: channel goes bye, your function gets the notification. periodt.
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. yes, the exact same one β it's not a copy, it's not a remix, it's the same value, fr fr π
Tcl_DeleteCloseHandler removes a close callback for channel. the proc and clientData identify which close callback to remove. and here's the tea: Tcl_DeleteCloseHandler does nothing if its proc and clientData arguments do not match the proc and clientData for a close handler for channel. like it just stands there. silently. no error, no drama, nothing π
π SEE ALSO π
close(3tcl), Tcl_Close(3tcl), Tcl_UnregisterChannel(3tcl)
β KEYWORDS β
callback, channel closing
and that's the whole page, bestie π this one's from the Tcl crew, version 7.5, dated 7.5 β Tcl_CreateCloseHandler(3tcl) and that's on periodt π
β¨
π¦ where this page comes from
- debian trixie: tcl9.0-doc 9.0.1+dfsg-2
- ubuntu questing: tcl9.0-doc 9.0.2+dfsg-1
- ubuntu resolute: tcl9.0-doc 9.0.3+dfsg-1
- ubuntu stonking: tcl9.0-doc 9.0.4+dfsg-1
- 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