2005-02-23 21:43:18 +00:00
|
|
|
#ifndef __GSRunLoopCtxt_h_GNUSTEP_BASE_INCLUDE
|
|
|
|
#define __GSRunLoopCtxt_h_GNUSTEP_BASE_INCLUDE
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
#include <Foundation/NSException.h>
|
|
|
|
#include <Foundation/NSMapTable.h>
|
|
|
|
#include <Foundation/NSRunLoop.h>
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Setup for inline operation of arrays.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define GSI_ARRAY_TYPES GSUNION_OBJ
|
|
|
|
|
|
|
|
#if GS_WITH_GC == 0
|
|
|
|
#define GSI_ARRAY_RELEASE(A, X) [(X).obj release]
|
|
|
|
#define GSI_ARRAY_RETAIN(A, X) [(X).obj retain]
|
|
|
|
#else
|
|
|
|
#define GSI_ARRAY_RELEASE(A, X)
|
|
|
|
#define GSI_ARRAY_RETAIN(A, X)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "GNUstepBase/GSIArray.h"
|
|
|
|
|
|
|
|
#ifdef HAVE_POLL
|
|
|
|
typedef struct{
|
|
|
|
int limit;
|
|
|
|
short *index;
|
|
|
|
}pollextra;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
@class NSString;
|
2006-03-24 10:59:00 +00:00
|
|
|
@class GSRunLoopWatcher;
|
2005-02-23 21:43:18 +00:00
|
|
|
|
|
|
|
@interface GSRunLoopCtxt : NSObject
|
|
|
|
{
|
|
|
|
@public
|
|
|
|
void *extra; /** Copy of the RunLoop ivar. */
|
|
|
|
NSString *mode; /** The mode for this context. */
|
|
|
|
GSIArray performers; /** The actions to perform regularly. */
|
|
|
|
GSIArray timers; /** The timers set for the runloop mode */
|
|
|
|
GSIArray watchers; /** The inputs set for the runloop mode */
|
2006-03-04 06:47:56 +00:00
|
|
|
NSTimer *housekeeper; /** Housekeeping timer for loop. */
|
2005-02-23 21:43:18 +00:00
|
|
|
@private
|
2005-10-11 19:09:26 +00:00
|
|
|
#if defined(__MINGW32__)
|
2005-02-23 21:43:18 +00:00
|
|
|
NSMapTable *handleMap;
|
2005-10-30 10:42:42 +00:00
|
|
|
NSMapTable *winMsgMap;
|
2005-02-23 21:43:18 +00:00
|
|
|
#else
|
|
|
|
NSMapTable *_efdMap;
|
|
|
|
NSMapTable *_rfdMap;
|
|
|
|
NSMapTable *_wfdMap;
|
|
|
|
#endif
|
2006-03-21 15:33:05 +00:00
|
|
|
GSIArray _trigger; // Watchers to trigger unconditionally.
|
|
|
|
int fairStart; // For trying to ensure fair handling.
|
2005-02-23 21:43:18 +00:00
|
|
|
BOOL completed; // To mark operation as completed.
|
|
|
|
#ifdef HAVE_POLL
|
|
|
|
unsigned int pollfds_capacity;
|
|
|
|
unsigned int pollfds_count;
|
|
|
|
struct pollfd *pollfds;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
- (void) endEvent: (void*)data
|
2006-03-24 10:59:00 +00:00
|
|
|
for: (GSRunLoopWatcher*)watcher;
|
2005-02-23 21:43:18 +00:00
|
|
|
- (void) endPoll;
|
|
|
|
- (id) initWithMode: (NSString*)theMode extra: (void*)e;
|
|
|
|
- (BOOL) pollUntil: (int)milliseconds within: (NSArray*)contexts;
|
|
|
|
@end
|
|
|
|
|
2006-03-04 06:47:56 +00:00
|
|
|
@interface NSRunLoop (Housekeeper)
|
|
|
|
- (void) _setHousekeeper: (NSTimer*)timer;
|
|
|
|
@end
|
|
|
|
|
2005-02-23 21:43:18 +00:00
|
|
|
#endif /* __GSRunLoopCtxt_h_GNUSTEP_BASE_INCLUDE */
|