⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 crtfilehdlr.3

📁 linux系统下的音频通信
💻 3
字号:
'\"'\" Copyright (c) 1990-1994 The Regents of the University of California.'\" Copyright (c) 1994-1997 Sun Microsystems, Inc.'\"'\" See the file "license.terms" for information on usage and redistribution'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.'\" '\" SCCS: @(#) CrtFileHdlr.3 1.7 97/04/23 16:11:17'\" .so man.macros.TH Tcl_CreateFileHandler 3 8.0 Tcl "Tcl Library Procedures".BS.SH NAMETcl_CreateFileHandler, Tcl_DeleteFileHandler \- associate procedure callbacks with files or devices (Unix only).SH SYNOPSIS.nf\fB#include <tcl.h>\fR.VS.sp\fBTcl_CreateFileHandler\fR(\fIfd, mask, proc, clientData\fR).sp\fBTcl_DeleteFileHandler\fR(\fIfd\fR).VE.SH ARGUMENTS.AS Tcl_FileProc clientData.VS.AP int fd inUnix file descriptor for an open file or device..VE.AP int mask inConditions under which \fIproc\fR should be called:OR-ed combination of \fBTCL_READABLE\fR, \fBTCL_WRITABLE\fR,and \fBTCL_EXCEPTION\fR.  May be set to 0 to temporarily disablea handler..AP Tcl_FileProc *proc inProcedure to invoke whenever the file or device indicatedby \fIfile\fR meets the conditions specified by \fImask\fR..AP ClientData clientData inArbitrary one-word value to pass to \fIproc\fR..BE.SH DESCRIPTION.PP.VS\fBTcl_CreateFileHandler\fR arranges for \fIproc\fR to beinvoked in the future whenever I/O becomes possible on a fileor an exceptional condition exists for the file.  The fileis indicated by \fIfd\fR, and the conditions of interest.VEare indicated by \fImask\fR.  For example, if \fImask\fRis \fBTCL_READABLE\fR, \fIproc\fR will be called whenthe file is readable.The callback to \fIproc\fR is made by \fBTcl_DoOneEvent\fR, so\fBTcl_CreateFileHandler\fR is only useful in programs that dispatchevents through \fBTcl_DoOneEvent\fR or through Tcl commands suchas \fBvwait\fR..PP\fIProc\fR should have arguments and result that match thetype \fBTcl_FileProc\fR:.CStypedef void Tcl_FileProc(	ClientData \fIclientData\fR,	int \fImask\fR);.CEThe \fIclientData\fR parameter to \fIproc\fR is a copyof the \fIclientData\fRargument given to \fBTcl_CreateFileHandler\fR when the callbackwas created.  Typically, \fIclientData\fR points to a datastructure containing application-specific information aboutthe file.  \fIMask\fR is an integer mask indicating whichof the requested conditions actually exists for the file;  itwill contain a subset of the bits in the \fImask\fR argumentto \fBTcl_CreateFileHandler\fR..PP.PPThere may exist only one handler for a given file at a given time.If \fBTcl_CreateFileHandler\fR is called when a handler alreadyexists for \fIfd\fR, then the new callback replaces the informationthat was previously recorded..PP\fBTcl_DeleteFileHandler\fR may be called to delete thefile handler for \fIfd\fR;  if no handler exists for thefile given by \fIfd\fR then the procedure has no effect..PPThe purpose of file handlers is to enable an application to respond toevents while waiting for files to become ready for I/O.  For this to workcorrectly, the application may need to use non-blocking I/O operations onthe files for which handlers are declared.  Otherwise the application mayblock if it reads or writes too much data; while waiting for the I/O tocomplete the application won't be able to service other events. Use\fBTcl_SetChannelOption\fR with \fB\-blocking\fR to set the channel intoblocking or nonblocking mode as required..PP.VSNote that these interfaces are only supported by the Uniximplementation of the Tcl notifier.   .VE.SH KEYWORDScallback, file, handler

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -