| [25] | 1 | '\" |
|---|
| 2 | '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. |
|---|
| 3 | '\" |
|---|
| 4 | '\" See the file "license.terms" for information on usage and redistribution |
|---|
| 5 | '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. |
|---|
| 6 | '\" |
|---|
| 7 | '\" RCS: @(#) $Id: CrtCloseHdlr.3,v 1.3 2004/10/07 14:44:31 dkf Exp $ |
|---|
| 8 | .so man.macros |
|---|
| 9 | .TH Tcl_CreateCloseHandler 3 7.5 Tcl "Tcl Library Procedures" |
|---|
| 10 | .BS |
|---|
| 11 | '\" Note: do not modify the .SH NAME line immediately below! |
|---|
| 12 | .SH NAME |
|---|
| 13 | Tcl_CreateCloseHandler, Tcl_DeleteCloseHandler \- arrange for callbacks when channels are closed |
|---|
| 14 | .SH SYNOPSIS |
|---|
| 15 | .nf |
|---|
| 16 | \fB#include <tcl.h>\fR |
|---|
| 17 | .sp |
|---|
| 18 | void |
|---|
| 19 | \fBTcl_CreateCloseHandler\fR(\fIchannel, proc, clientData\fR) |
|---|
| 20 | .sp |
|---|
| 21 | void |
|---|
| 22 | \fBTcl_DeleteCloseHandler\fR(\fIchannel, proc, clientData\fR) |
|---|
| 23 | .sp |
|---|
| 24 | .SH ARGUMENTS |
|---|
| 25 | .AS Tcl_CloseProc clientData |
|---|
| 26 | .AP Tcl_Channel channel in |
|---|
| 27 | The channel for which to create or delete a close callback. |
|---|
| 28 | .AP Tcl_CloseProc *proc in |
|---|
| 29 | The procedure to call as the callback. |
|---|
| 30 | .AP ClientData clientData in |
|---|
| 31 | Arbitrary one-word value to pass to \fIproc\fR. |
|---|
| 32 | .BE |
|---|
| 33 | |
|---|
| 34 | .SH DESCRIPTION |
|---|
| 35 | .PP |
|---|
| 36 | \fBTcl_CreateCloseHandler\fR arranges for \fIproc\fR to be called when |
|---|
| 37 | \fIchannel\fR is closed with \fBTcl_Close\fR or |
|---|
| 38 | \fBTcl_UnregisterChannel\fR, or using the Tcl \fBclose\fR command. |
|---|
| 39 | \fIProc\fR should match the following prototype: |
|---|
| 40 | .PP |
|---|
| 41 | .CS |
|---|
| 42 | typedef void Tcl_CloseProc( |
|---|
| 43 | ClientData \fIclientData\fR); |
|---|
| 44 | .CE |
|---|
| 45 | .PP |
|---|
| 46 | The \fIclientData\fR is the same as the value provided in the call to |
|---|
| 47 | \fBTcl_CreateCloseHandler\fR. |
|---|
| 48 | .PP |
|---|
| 49 | \fBTcl_DeleteCloseHandler\fR removes a close callback for \fIchannel\fR. |
|---|
| 50 | The \fIproc\fR and \fIclientData\fR identify which close callback to |
|---|
| 51 | remove; \fBTcl_DeleteCloseHandler\fR does nothing if its \fIproc\fR and |
|---|
| 52 | \fIclientData\fR arguments do not match the \fIproc\fR and \fIclientData\fR |
|---|
| 53 | for a close handler for \fIchannel\fR. |
|---|
| 54 | |
|---|
| 55 | .SH "SEE ALSO" |
|---|
| 56 | close(n), Tcl_Close(3), Tcl_UnregisterChannel(3) |
|---|
| 57 | |
|---|
| 58 | .SH KEYWORDS |
|---|
| 59 | callback, channel closing |
|---|