4 Copyright (C) 1995, 1996 Ovidiu Predescu and Mircea Oancea.
7 Author: Ovidiu Predescu <ovidiu@bx.logicnet.ro>
9 This file is part of libFoundation.
11 Permission to use, copy, modify, and distribute this software and its
12 documentation for any purpose and without fee is hereby granted, provided
13 that the above copyright notice appear in all copies and that both that
14 copyright notice and this permission notice appear in supporting
17 We disclaim all warranties with regard to this software, including all
18 implied warranties of merchantability and fitness, in no event shall
19 we be liable for any special, indirect or consequential damages or any
20 damages whatsoever resulting from loss of use, data or profits, whether in
21 an action of contract, negligence or other tortious action, arising out of
22 or in connection with the use or performance of this software.
25 #ifndef __NSRunLoop_h__
26 #define __NSRunLoop_h__
28 #include <Foundation/NSObject.h>
30 @class NSString, NSDate, NSTimer, NSNotification;
31 @class NSPosixFileDescriptor;
32 @class NSMutableArray, NSMutableDictionary;
35 LF_EXPORT NSString *NSDefaultRunLoopMode;
36 LF_EXPORT NSString *NSConnectionReplyMode;
38 LF_EXPORT NSString *NSFileObjectBecameActiveNotificationName; // not OpenStep
40 @interface NSRunLoop : NSObject
42 NSMutableDictionary *inputsForMode;
46 /* Accessing the Current Run Loop */
47 + (NSRunLoop*)currentRunLoop;
48 - (NSString*)currentMode;
49 - (NSDate*)limitDateForMode:(NSString*)mode;
52 - (void)addTimer:(NSTimer*)aTimer
53 forMode:(NSString*)mode;
55 /* Running a Run Loop */
56 - (void)acceptInputForMode:(NSString*)mode
57 beforeDate:(NSDate*)limitDate;
59 - (BOOL)runMode:(NSString*)mode
60 beforeDate:(NSDate*)limitDate;
61 - (void)runUntilDate:(NSDate*)limitDate;
63 /* Delayed perform of an action */
64 - (void)performSelector:(SEL)aSelector
66 argument:(id)anArgument
68 modes:(NSArray*)modes;
69 - (void)cancelPerformSelector:(SEL)aSelector
71 argument:(id)anArgument;
73 /* Monitoring file descriptors */
74 - (void)addPosixFileDescriptor:(NSPosixFileDescriptor*)fileDescriptor
75 forMode:(NSString*)mode;
76 - (void)removePosixFileDescriptor:(NSPosixFileDescriptor*)fileDescriptor
77 forMode:(NSString*)mode;
79 /* Monitoring file objects */
80 - (void)addFileObject:(id)_fileObject
81 activities:(unsigned int)_activities
82 forMode:(NSString *)_mode;
83 - (void)removeFileObject:(id)_fileObject
84 forMode:(NSString *)_mode;
87 - (void)addPort:(NSPort *)_port forMode:(NSString *)_mode;
88 - (void)removePort:(NSPort *)_port forMode:(NSString *)_mode;
90 /* Server operation */
91 - (void)configureAsServer;
94 + (void)taskNowMultiThreaded:(NSNotification *)notification;
98 @interface NSObject(RunloopFileObject)
100 - (int)fileDescriptor;
104 #endif /* __NSRunLoop_h__ */