1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
/*
* tclUnixNotify.c --
*
* This file contains the implementation of the select()-based
* Unix-specific notifier, which is the lowest-level part of the Tcl
* event loop. This file works together with generic/tclNotify.c.
*
* Copyright (c) 1995-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.
*
* RCS: @(#) $Id: tclUnixNotfy.c,v 1.32 2006/08/21 01:08:03 das Exp $
*/
#include "tclInt.h"
#ifndef HAVE_COREFOUNDATION /* Darwin/Mac OS X CoreFoundation notifier is
* in tclMacOSXNotify.c */
#include <signal.h>
|
|
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
/*
* tclUnixNotify.c --
*
* This file contains the implementation of the select()-based
* Unix-specific notifier, which is the lowest-level part of the Tcl
* event loop. This file works together with generic/tclNotify.c.
*
* Copyright (c) 1995-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.
*
* RCS: @(#) $Id: tclUnixNotfy.c,v 1.33 2008/02/28 20:12:09 jenglish Exp $
*/
#include "tclInt.h"
#ifndef HAVE_COREFOUNDATION /* Darwin/Mac OS X CoreFoundation notifier is
* in tclMacOSXNotify.c */
#include <signal.h>
|
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
|
if (pipe(fds) != 0) {
Tcl_Panic("NotifierThreadProc: could not create trigger pipe");
}
receivePipe = fds[0];
#ifndef USE_FIONBIO
status = fcntl(receivePipe, F_GETFL);
status |= O_NONBLOCK;
if (fcntl(receivePipe, F_SETFL, status) < 0) {
Tcl_Panic("NotifierThreadProc: could not make receive pipe non blocking");
}
status = fcntl(fds[1], F_GETFL);
status |= O_NONBLOCK;
if (fcntl(fds[1], F_SETFL, status) < 0) {
Tcl_Panic("NotifierThreadProc: could not make trigger pipe non blocking");
}
#else
if (ioctl(receivePipe, (int) FIONBIO, &status) < 0) {
Tcl_Panic("NotifierThreadProc: could not make receive pipe non blocking");
}
if (ioctl(fds[1], (int) FIONBIO, &status) < 0) {
Tcl_Panic("NotifierThreadProc: could not make trigger pipe non blocking");
}
#endif /* FIONBIO */
/*
* Install the write end of the pipe into the global variable.
*/
Tcl_MutexLock(¬ifierMutex);
triggerPipe = fds[1];
|
<
|
<
<
<
|
<
<
<
<
<
<
<
<
<
|
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
|
if (pipe(fds) != 0) {
Tcl_Panic("NotifierThreadProc: could not create trigger pipe");
}
receivePipe = fds[0];
if (TclUnixSetBlockingMode(receivePipe, TCL_MODE_NONBLOCKING) < 0) {
Tcl_Panic("NotifierThreadProc: could not make receive pipe non blocking");
}
if (TclUnixSetBlockingMode(fds[1], TCL_MODE_NONBLOCKING) < 0) {
Tcl_Panic("NotifierThreadProc: could not make trigger pipe non blocking");
}
/*
* Install the write end of the pipe into the global variable.
*/
Tcl_MutexLock(¬ifierMutex);
triggerPipe = fds[1];
|