TCL_DELETECLOSEHANDLER(3tcl)

πŸ“¦
version 9.0.4 Β· 2 versions
, in debian trixie, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ’– 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 to proc. 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