Major rewrite of NSRunLoop

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@12235 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-Macdonald 2002-01-28 15:16:33 +00:00
parent 57f69ef61c
commit 5c70666c43
7 changed files with 1272 additions and 724 deletions

View file

@ -1,3 +1,28 @@
2002-01-28 Richard Frith-Macdonald <rfm@gnu.org>
* Headers/Foundation/NSRunLoop.h: Removed previously deprecated methods.
Completely changed ivar layout.
* Headers/Foundation/NSRunLoop.m: Removed previously deprecated methods.
Completely changed ivar layout. Modified most methods to work with
changed ivar layout. Now stores per-mode context information in a
new GSRunLoopCtxt class - one instance for each mode used in each
runloop instance. Rewrite select() and poll() based mechanisms
using the new class - should hopefully be more efficient and fix
minor and obscure problems with re-entrancy.
### WARNING ... radical change ... may be buggy ... WARNING ###
2002-01-23 Kaelin Colclasure <kaelin@acm.org>
* configure.in: Check for poll(2) system call and header file.
* configure: Regenerated.
* config.h.in: Regenerated.
* Source/NSRunLoop.m ([-acceptInputForMode:beforeDate:]):
Refactored to put all code specific to the select(2) system call
into a separate method.
([-_pollInputForMode:withTimeout:]): New private method with two
implementations. If HAVE_POLL is defined, the poll version is
used. Otherwise, we fall back to select.
2002-01-25 Richard Frith-Macdonald <rfm@gnu.org>
* acconfig.h: Add HAVE_SA_LEN

View file

@ -34,15 +34,10 @@ GS_EXPORT NSString* const NSDefaultRunLoopMode;
@interface NSRunLoop : NSObject <GCFinalization>
{
@private
id _current_mode;
NSMapTable *_mode_2_timers;
NSMapTable *_mode_2_watchers;
NSMapTable *_mode_2_performers;
NSMutableArray *_timedPerformers;
NSMapTable *_efdMap;
NSMapTable *_rfdMap;
NSMapTable *_wfdMap;
int _fdStart;
NSString *_current_mode;
NSMutableArray *_timedPerformers;
NSMapTable *_mode_2_context;
void *_extra;
}
+ (NSRunLoop*) currentRunLoop;
@ -55,7 +50,7 @@ GS_EXPORT NSString* const NSDefaultRunLoopMode;
- (NSString*) currentMode;
- (NSDate*)limitDateForMode: (NSString*)mode;
- (NSDate*) limitDateForMode: (NSString*)mode;
- (void) run;
@ -72,14 +67,14 @@ GS_EXPORT NSString* const NSDefaultRunLoopMode;
forMode: (NSString*)mode;
- (void) cancelPerformSelector: (SEL)aSelector
target: target
argument: argument;
target: (id)target
argument: (id)argument;
- (void) configureAsServer;
- (void) performSelector: (SEL)aSelector
target: target
argument: argument
target: (id)target
argument: (id)argument
order: (unsigned int)order
modes: (NSArray*)modes;
@ -93,10 +88,10 @@ GS_EXPORT NSString* const NSDefaultRunLoopMode;
*/
typedef enum {
ET_RDESC, /* Watch for descriptor becoming readable. */
ET_WDESC, /* Watch for descriptor becoming writeable. */
ET_RPORT, /* Watch for message arriving on port. */
ET_EDESC /* Watch for descriptor with exception data. */
ET_RDESC, /* Watch for descriptor becoming readable. */
ET_WDESC, /* Watch for descriptor becoming writeable. */
ET_RPORT, /* Watch for message arriving on port. */
ET_EDESC /* Watch for descriptor with exception data. */
} RunLoopEventType;
@protocol RunLoopEvents
@ -125,29 +120,9 @@ typedef enum {
@interface NSRunLoop(GNUstepExtensions)
#if 0
/*
* The following ten methods are DEPRECATED
* They will be removed in later releases of GNUstep
*/
+ currentInstance;
+ (NSString*) currentMode;
+ (void) run;
+ (BOOL) runOnceBeforeDate: (NSDate*)date;
+ (BOOL) runOnceBeforeDate: (NSDate*)date
forMode: (NSString*)mode;
+ (void) runUntilDate: (NSDate*)date;
+ (void) runUntilDate: (NSDate*)date
forMode: (NSString*)mode;
- (BOOL) runOnceBeforeDate: (NSDate*)date;
- (BOOL) runOnceBeforeDate: (NSDate*)date
forMode: (NSString*)mode;
- (void) runUntilDate: (NSDate*)date
forMode: (NSString*)mode;
#endif
/*
* These next two are general purpose methods for letting objects
* ask the runloop to watch for events for them. Only one object
* These are general purpose methods for letting objects ask
* the runloop to watch for events for them. Only one object
* at a time may be watching for a particular event in a mode, but
* that object may add itsself as a watcher many times as long as
* each addition is matched by a removal (the run loop keeps count).

View file

@ -127,6 +127,9 @@
/* Define if you have the objc_thread_add function. */
#undef HAVE_OBJC_THREAD_ADD
/* Define if you have the poll function. */
#undef HAVE_POLL
/* Define if you have the readlink function. */
#undef HAVE_READLINK
@ -220,6 +223,9 @@
/* Define if you have the <openssl/ssl.h> header file. */
#undef HAVE_OPENSSL_SSL_H
/* Define if you have the <poll.h> header file. */
#undef HAVE_POLL_H
/* Define if you have the <pthread.h> header file. */
#undef HAVE_PTHREAD_H

View file

@ -435,7 +435,7 @@ add_to_queue(NSNotificationQueueList *queue, NSNotification *notification,
- (void) postNotification: (NSNotification*)notification
forModes: (NSArray*)modes
{
NSString *mode = [NSRunLoop currentMode];
NSString *mode = [[NSRunLoop currentRunLoop] currentMode];
// check to see if run loop is in a valid mode
if (mode == nil || modes == nil

File diff suppressed because it is too large Load diff

402
configure vendored

File diff suppressed because it is too large Load diff

View file

@ -518,6 +518,13 @@ dnl AC_REPLACE_FUNCS(recvfrom)
AC_CHECK_HEADERS(syslog.h)
AC_CHECK_FUNCS(syslog)
#--------------------------------------------------------------------
# These headers/functions needed by NSRunLoop.m
#--------------------------------------------------------------------
AC_CHECK_HEADERS(poll.h)
AC_CHECK_FUNCS(poll)
#--------------------------------------------------------------------
# Check for pthread.h (only when building on Darwin machines)
#--------------------------------------------------------------------