mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-22 16:33:29 +00:00
More tidyups
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@23914 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
6e8a8de18e
commit
0d0ae9d9a8
16 changed files with 156 additions and 285 deletions
20
ChangeLog
20
ChangeLog
|
@ -1,6 +1,26 @@
|
|||
2006-10-19 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Documentation/manual/DistributedObjects.texi: Update for current API
|
||||
* Source/NSNotificationQueue.m:
|
||||
* Source/NSSocketPort.m:
|
||||
* Source/NSRunLoop.m:
|
||||
* Source/NSUserDefaults.m:
|
||||
* Source/NSMessagePortNameServer.m:
|
||||
* Source/NSDebug.m:
|
||||
* Source/unix/GSRunLoopCtxt.m:
|
||||
* Source/GSPrivate.h:
|
||||
* Source/win32/GSFileHandleWin32.m:
|
||||
* Source/win32/GSRunLoopCtxt.m:
|
||||
* Source/NSCoder.m:
|
||||
* Source/Additions/GSPrivate.m:
|
||||
* Source/NSAutoreleasePool.m:
|
||||
* Source/NSTask.m:
|
||||
* Headers/Foundation/NSCoder.h:
|
||||
Remove long deprecated coder extensions (old libobjects
|
||||
compatibility).
|
||||
Hide some internal functions.
|
||||
Make some values static.
|
||||
Make function to obtain locale dictionary thread safe.
|
||||
|
||||
2006-10-19 Matt Rice <ratmice@yahoo.com>
|
||||
|
||||
|
|
|
@ -353,46 +353,6 @@ extern "C" {
|
|||
#endif
|
||||
@end
|
||||
|
||||
#ifndef NO_GNUSTEP
|
||||
|
||||
/**
|
||||
* GNUstep extensions to [NSCoder], supporting compatibility with libObjects.
|
||||
* DEPRECATED
|
||||
*/
|
||||
@interface NSCoder (GNUstep)
|
||||
/* Compatibility with libObjects */
|
||||
- (void) decodeArrayOfObjCType: (const char*)type
|
||||
count: (unsigned)count
|
||||
at: (void*)buf
|
||||
withName: (id*)name;
|
||||
/** <override-dummy /> decodes indentation */
|
||||
- (void) decodeIndent;
|
||||
- (void) decodeObjectAt: (id*)anObject
|
||||
withName: (id*)name;
|
||||
- (void) decodeValueOfCType: (const char*)type
|
||||
at: (void*)buf
|
||||
withName: (id*)name;
|
||||
- (void) decodeValueOfObjCType: (const char*)type
|
||||
at: (void*)buf
|
||||
withName: (id*)name;
|
||||
- (void) encodeArrayOfObjCType: (const char*)type
|
||||
count: (unsigned)count
|
||||
at: (const void*)buf
|
||||
withName: (id)name;
|
||||
/** <override-dummy /> encodes indentation */
|
||||
- (void) encodeIndent;
|
||||
- (void) encodeObjectAt: (id*)anObject
|
||||
withName: (id)name;
|
||||
- (void) encodeValueOfCType: (const char*)type
|
||||
at: (const void*)buf
|
||||
withName: (id)name;
|
||||
- (void) encodeValueOfObjCType: (const char*)type
|
||||
at: (const void*)buf
|
||||
withName: (id)name;
|
||||
@end
|
||||
|
||||
#endif /* NO_GNUSTEP */
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -49,25 +49,6 @@ strerror(int eno)
|
|||
|
||||
@implementation GSPrivate
|
||||
|
||||
- (void) defaultsChanged: (NSNotification*)n
|
||||
{
|
||||
[gnustep_global_lock lock];
|
||||
if (cachedLocale == nil)
|
||||
{
|
||||
if (n == nil)
|
||||
{
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
addObserver: self
|
||||
selector: _cmd
|
||||
name: NSUserDefaultsDidChangeNotification
|
||||
object: nil];
|
||||
}
|
||||
ASSIGN(cachedLocale,
|
||||
[[NSUserDefaults standardUserDefaults] dictionaryRepresentation]);
|
||||
}
|
||||
[gnustep_global_lock unlock];
|
||||
}
|
||||
|
||||
- (NSString*) error
|
||||
{
|
||||
#if defined(__MINGW32__)
|
||||
|
@ -85,7 +66,7 @@ strerror(int eno)
|
|||
LPVOID lpMsgBuf;
|
||||
|
||||
FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
|
||||
NULL, nuymber, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
|
||||
NULL, number, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
|
||||
(LPWSTR) &lpMsgBuf, 0, NULL );
|
||||
text = [NSString stringWithCharacters: lpMsgBuf length: wcslen(lpMsgBuf)];
|
||||
LocalFree(lpMsgBuf);
|
||||
|
@ -98,13 +79,3 @@ strerror(int eno)
|
|||
@end
|
||||
|
||||
|
||||
NSDictionary *
|
||||
GSPrivateDefaultLocale()
|
||||
{
|
||||
if (_GSPrivate->cachedLocale == nil)
|
||||
{
|
||||
[_GSPrivate defaultsChanged: nil];
|
||||
}
|
||||
return _GSPrivate->cachedLocale;
|
||||
}
|
||||
|
||||
|
|
|
@ -220,11 +220,12 @@ typedef enum {
|
|||
|
||||
/*
|
||||
* Functions used by the NSRunLoop and friends for processing
|
||||
* queued notifications.
|
||||
* queued notifications and task completion events.
|
||||
*/
|
||||
extern void GSNotifyASAP(void);
|
||||
extern void GSNotifyIdle(void);
|
||||
extern BOOL GSNotifyMore(void);
|
||||
BOOL GSPrivateCheckTasks(void) GS_ATTRIB_PRIVATE;
|
||||
void GSPrivateNotifyASAP(void) GS_ATTRIB_PRIVATE;
|
||||
void GSPrivateNotifyIdle(void) GS_ATTRIB_PRIVATE;
|
||||
BOOL GSPrivateNotifyMore(void) GS_ATTRIB_PRIVATE;
|
||||
|
||||
/* This class exists to encapsulate various otherwise unrelated functions
|
||||
* so that we expose a single global symbol (the class) whose name marks it
|
||||
|
@ -237,14 +238,8 @@ extern BOOL GSNotifyMore(void);
|
|||
*/
|
||||
@interface GSPrivate : NSObject
|
||||
{
|
||||
@public
|
||||
NSDictionary *cachedLocale;
|
||||
}
|
||||
|
||||
/* Update information from defaults system
|
||||
*/
|
||||
- (void) defaultsChanged: (NSNotification*)n;
|
||||
|
||||
/* Return the text describing the last system error to have occurred.
|
||||
*/
|
||||
- (NSString*) error;
|
||||
|
|
|
@ -380,7 +380,7 @@ static IMP initImp;
|
|||
* releasing. */
|
||||
while (released != 0)
|
||||
{
|
||||
id *objects = released->objects;
|
||||
id *objects = (id*)(released->objects);
|
||||
|
||||
for (i = 0; i < released->count; i++)
|
||||
{
|
||||
|
|
102
Source/NSCoder.m
102
Source/NSCoder.m
|
@ -19,7 +19,8 @@
|
|||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 USA.
|
||||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02111 USA.
|
||||
|
||||
<title>NSCoder class reference</title>
|
||||
$Date$ $Revision$
|
||||
|
@ -410,105 +411,6 @@
|
|||
|
||||
@end
|
||||
|
||||
@implementation NSCoder (GNUstep)
|
||||
- (void) decodeArrayOfObjCType: (const char*)type
|
||||
count: (unsigned)count
|
||||
at: (void*)buf
|
||||
withName: (id*)name
|
||||
{
|
||||
GSOnceMLog(@"Deprecated, use NSKeyedArchiver methods");
|
||||
if (name)
|
||||
{
|
||||
*name = [self decodeObject];
|
||||
}
|
||||
else
|
||||
{
|
||||
(void)[self decodeObject];
|
||||
}
|
||||
[self decodeArrayOfObjCType: type count: count at: buf];
|
||||
}
|
||||
|
||||
/** <override-dummy />
|
||||
*/
|
||||
- (void) decodeIndent
|
||||
{
|
||||
GSOnceMLog(@"Deprecated, use NSKeyedArchiver methods");
|
||||
}
|
||||
|
||||
- (void) decodeObjectAt: (id*)anObject
|
||||
withName: (id*)name
|
||||
{
|
||||
GSOnceMLog(@"Deprecated, use NSKeyedArchiver methods");
|
||||
[self decodeValueOfObjCType: @encode(id) at: anObject withName: name];
|
||||
}
|
||||
|
||||
- (void) decodeValueOfCType: (const char*)type
|
||||
at: (void*)buf
|
||||
withName: (id*)name
|
||||
{
|
||||
GSOnceMLog(@"Deprecated, use NSKeyedArchiver methods");
|
||||
[self decodeValueOfObjCType: type at: buf withName: name];
|
||||
}
|
||||
|
||||
- (void) decodeValueOfObjCType: (const char*)type
|
||||
at: (void*)buf
|
||||
withName: (id*)name
|
||||
{
|
||||
GSOnceMLog(@"Deprecated, use NSKeyedArchiver methods");
|
||||
if (name != 0)
|
||||
{
|
||||
*name = [self decodeObject];
|
||||
}
|
||||
else
|
||||
{
|
||||
(void)[self decodeObject];
|
||||
}
|
||||
[self decodeValueOfObjCType: type at: buf];
|
||||
}
|
||||
|
||||
- (void) encodeArrayOfObjCType: (const char*)type
|
||||
count: (unsigned)count
|
||||
at: (const void*)buf
|
||||
withName: (id)name
|
||||
{
|
||||
GSOnceMLog(@"Deprecated, use NSKeyedArchiver methods");
|
||||
[self encodeObject: name];
|
||||
[self encodeArrayOfObjCType: type count: count at: buf];
|
||||
}
|
||||
|
||||
/** <override-dummy />
|
||||
*/
|
||||
- (void) encodeIndent
|
||||
{
|
||||
GSOnceMLog(@"Deprecated, use NSKeyedArchiver methods");
|
||||
}
|
||||
|
||||
- (void) encodeValueOfCType: (const char*)type
|
||||
at: (const void*)buf
|
||||
withName: (id)name
|
||||
{
|
||||
GSOnceMLog(@"Deprecated, use NSKeyedArchiver methods");
|
||||
[self encodeValueOfObjCType: type at: buf withName: name];
|
||||
}
|
||||
|
||||
- (void) encodeValueOfObjCType: (const char*)type
|
||||
at: (const void*)buf
|
||||
withName: (id)name
|
||||
{
|
||||
GSOnceMLog(@"Deprecated, use NSKeyedArchiver methods");
|
||||
[self encodeObject: name];
|
||||
[self encodeValueOfObjCType: type at: buf];
|
||||
}
|
||||
|
||||
- (void) encodeObjectAt: (id*)anObject
|
||||
withName: (id)name
|
||||
{
|
||||
GSOnceMLog(@"Deprecated, use NSKeyedArchiver methods");
|
||||
[self encodeValueOfObjCType: @encode(id) at: anObject withName: name];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
|
||||
#include "GSPrivate.h"
|
||||
|
|
|
@ -63,11 +63,13 @@ static NSLock *uniqueLock = nil;
|
|||
static const char* _GSDebugAllocationList(BOOL difference);
|
||||
static const char* _GSDebugAllocationListAll(void);
|
||||
|
||||
void _GSDebugAllocationAdd(Class c, id o);
|
||||
void _GSDebugAllocationRemove(Class c, id o);
|
||||
static void _GSDebugAllocationAdd(Class c, id o);
|
||||
static void _GSDebugAllocationRemove(Class c, id o);
|
||||
|
||||
void (*_GSDebugAllocationAddFunc)(Class c, id o) = _GSDebugAllocationAdd;
|
||||
void (*_GSDebugAllocationRemoveFunc)(Class c, id o) = _GSDebugAllocationRemove;
|
||||
static void (*_GSDebugAllocationAddFunc)(Class c, id o)
|
||||
= _GSDebugAllocationAdd;
|
||||
static void (*_GSDebugAllocationRemoveFunc)(Class c, id o)
|
||||
= _GSDebugAllocationRemove;
|
||||
|
||||
@interface GSDebugAlloc : NSObject
|
||||
+ (void) initialize;
|
||||
|
|
|
@ -252,6 +252,10 @@ static void clean_up_names(void)
|
|||
}
|
||||
}
|
||||
|
||||
- (NSPort*) portForName: (NSString*)name
|
||||
{
|
||||
return [self portForName: name onHost: nil];
|
||||
}
|
||||
|
||||
- (NSPort*) portForName: (NSString *)name
|
||||
onHost: (NSString *)host
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
#include "Foundation/NSString.h"
|
||||
#include "Foundation/NSThread.h"
|
||||
|
||||
#include "GSPrivate.h"
|
||||
/* NotificationQueueList by Richard Frith-Macdonald
|
||||
These objects are used to maintain lists of NSNotificationQueue objects.
|
||||
There is one list per NSThread, with the first object in the list stored
|
||||
|
@ -574,7 +575,7 @@ static inline void notifyASAP(NSNotificationQueue *q)
|
|||
}
|
||||
|
||||
void
|
||||
GSNotifyASAP()
|
||||
GSPrivateNotifyASAP()
|
||||
{
|
||||
NotificationQueueList *item;
|
||||
|
||||
|
@ -613,7 +614,7 @@ static inline void notifyIdle(NSNotificationQueue *q)
|
|||
}
|
||||
|
||||
void
|
||||
GSNotifyIdle()
|
||||
GSPrivateNotifyIdle()
|
||||
{
|
||||
NotificationQueueList *item;
|
||||
|
||||
|
@ -627,7 +628,7 @@ GSNotifyIdle()
|
|||
}
|
||||
|
||||
BOOL
|
||||
GSNotifyMore()
|
||||
GSPrivateNotifyMore()
|
||||
{
|
||||
NotificationQueueList *item;
|
||||
|
||||
|
|
|
@ -45,6 +45,7 @@
|
|||
#include "GSRunLoopCtxt.h"
|
||||
#include "GSRunLoopWatcher.h"
|
||||
#include "GSStream.h"
|
||||
|
||||
#include "GSPrivate.h"
|
||||
|
||||
#ifdef HAVE_SYS_TYPES_H
|
||||
|
@ -68,8 +69,6 @@ NSString * const NSDefaultRunLoopMode = @"NSDefaultRunLoopMode";
|
|||
|
||||
static NSDate *theFuture = nil;
|
||||
|
||||
extern BOOL GSCheckTasks();
|
||||
|
||||
@interface NSObject (OptionalPortRunLoop)
|
||||
- (void) getFds: (int*)fds count: (int*)count;
|
||||
@end
|
||||
|
@ -823,7 +822,7 @@ static NSComparisonResult tSort(GSIArrayItem i0, GSIArrayItem i1)
|
|||
{
|
||||
RELEASE(min_timer);
|
||||
}
|
||||
GSNotifyASAP(); /* Post notifications. */
|
||||
GSPrivateNotifyASAP(); /* Post notifications. */
|
||||
IF_NO_GC([arp emptyPool]);
|
||||
}
|
||||
_currentMode = savedMode;
|
||||
|
@ -915,19 +914,19 @@ static NSComparisonResult tSort(GSIArrayItem i0, GSIArrayItem i1)
|
|||
|| (i = GSIArrayCount(watchers)) == 0))
|
||||
{
|
||||
NSDebugMLLog(@"NSRunLoop", @"no inputs in mode %@", mode);
|
||||
GSNotifyASAP();
|
||||
GSNotifyIdle();
|
||||
GSPrivateNotifyASAP();
|
||||
GSPrivateNotifyIdle();
|
||||
/*
|
||||
* Pause for as long as possible (up to the limit date)
|
||||
*/
|
||||
[NSThread sleepUntilDate: limit_date];
|
||||
ti = [limit_date timeIntervalSinceNow];
|
||||
GSCheckTasks();
|
||||
GSPrivateCheckTasks();
|
||||
if (context != nil)
|
||||
{
|
||||
[self _checkPerformers: context];
|
||||
}
|
||||
GSNotifyASAP();
|
||||
GSPrivateNotifyASAP();
|
||||
_currentMode = savedMode;
|
||||
RELEASE(arp);
|
||||
NS_VOIDRETURN;
|
||||
|
@ -961,10 +960,10 @@ static NSComparisonResult tSort(GSIArrayItem i0, GSIArrayItem i1)
|
|||
}
|
||||
if ([context pollUntil: timeout_ms within: _contextStack] == NO)
|
||||
{
|
||||
GSNotifyIdle();
|
||||
GSPrivateNotifyIdle();
|
||||
}
|
||||
[self _checkPerformers: context];
|
||||
GSNotifyASAP();
|
||||
GSPrivateNotifyASAP();
|
||||
_currentMode = savedMode;
|
||||
/*
|
||||
* Once a poll has been completed on a context, we can remove that
|
||||
|
@ -1011,9 +1010,9 @@ static NSComparisonResult tSort(GSIArrayItem i0, GSIArrayItem i1)
|
|||
/*
|
||||
* Notify if any tasks have completed.
|
||||
*/
|
||||
if (GSCheckTasks() == YES)
|
||||
if (GSPrivateCheckTasks() == YES)
|
||||
{
|
||||
GSNotifyASAP();
|
||||
GSPrivateNotifyASAP();
|
||||
}
|
||||
RELEASE(arp);
|
||||
return NO;
|
||||
|
|
|
@ -1262,7 +1262,7 @@ static Class runLoopClass;
|
|||
if (ocurredEvents.lNetworkEvents & FD_CONNECT)
|
||||
{
|
||||
[self receivedEventWrite];
|
||||
GSNotifyASAP();
|
||||
GSPrivateNotifyASAP();
|
||||
if (desc == INVALID_SOCKET)
|
||||
{
|
||||
M_UNLOCK(myLock);
|
||||
|
@ -1273,7 +1273,7 @@ static Class runLoopClass;
|
|||
if (ocurredEvents.lNetworkEvents & FD_READ)
|
||||
{
|
||||
[self receivedEventRead];
|
||||
GSNotifyASAP();
|
||||
GSPrivateNotifyASAP();
|
||||
if (desc == INVALID_SOCKET)
|
||||
{
|
||||
M_UNLOCK(myLock);
|
||||
|
@ -1284,7 +1284,7 @@ static Class runLoopClass;
|
|||
if (ocurredEvents.lNetworkEvents & FD_OOB)
|
||||
{
|
||||
[self receivedEventRead];
|
||||
GSNotifyASAP();
|
||||
GSPrivateNotifyASAP();
|
||||
if (desc == INVALID_SOCKET)
|
||||
{
|
||||
M_UNLOCK(myLock);
|
||||
|
@ -1296,7 +1296,7 @@ static Class runLoopClass;
|
|||
{
|
||||
readyToSend = YES;
|
||||
[self receivedEventWrite];
|
||||
GSNotifyASAP();
|
||||
GSPrivateNotifyASAP();
|
||||
if (desc == INVALID_SOCKET)
|
||||
{
|
||||
M_UNLOCK(myLock);
|
||||
|
@ -1307,7 +1307,7 @@ static Class runLoopClass;
|
|||
if (ocurredEvents.lNetworkEvents & FD_CLOSE)
|
||||
{
|
||||
[self receivedEventRead];
|
||||
GSNotifyASAP();
|
||||
GSPrivateNotifyASAP();
|
||||
if (desc == INVALID_SOCKET)
|
||||
{
|
||||
M_UNLOCK(myLock);
|
||||
|
|
|
@ -922,7 +922,7 @@ pty_slave(const char* name)
|
|||
@implementation NSConcreteWindowsTask
|
||||
|
||||
BOOL
|
||||
GSCheckTasks()
|
||||
GSPrivateCheckTasks()
|
||||
{
|
||||
BOOL found = NO;
|
||||
|
||||
|
@ -1257,7 +1257,7 @@ quotedFromString(NSString *aString)
|
|||
@implementation NSConcreteUnixTask
|
||||
|
||||
BOOL
|
||||
GSCheckTasks()
|
||||
GSPrivateCheckTasks()
|
||||
{
|
||||
BOOL found = NO;
|
||||
|
||||
|
|
|
@ -1967,3 +1967,21 @@ static BOOL isLocked = NO;
|
|||
}
|
||||
@end
|
||||
|
||||
/* FIXME ... Slightly faster than
|
||||
* [[NSUserDefaults standardUserDefaults] dictionaryRepresentation]
|
||||
* but is it really worthwile?
|
||||
*/
|
||||
NSDictionary *GSPrivateDefaultLocale()
|
||||
{
|
||||
NSDictionary *locale;
|
||||
|
||||
[classLock lock];
|
||||
if (sharedDefaults == nil)
|
||||
{
|
||||
[NSUserDefaults standardUserDefaults];
|
||||
}
|
||||
locale = [sharedDefaults dictionaryRepresentation];
|
||||
[classLock unlock];
|
||||
return locale;
|
||||
}
|
||||
|
||||
|
|
|
@ -30,8 +30,6 @@
|
|||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
extern BOOL GSCheckTasks();
|
||||
|
||||
#if GS_WITH_GC == 0
|
||||
static SEL wRelSel;
|
||||
static SEL wRetSel;
|
||||
|
@ -368,7 +366,7 @@ static void setPollfd(int fd, int event, GSRunLoopCtxt *ctxt)
|
|||
* we can service the queue. Similarly, if a task has completed,
|
||||
* we need to deliver its notifications.
|
||||
*/
|
||||
if (GSCheckTasks() || GSNotifyMore() || immediate == YES)
|
||||
if (GSPrivateCheckTasks() || GSPrivateNotifyMore() || immediate == YES)
|
||||
{
|
||||
milliseconds = 0;
|
||||
}
|
||||
|
@ -406,7 +404,7 @@ static void setPollfd(int fd, int event, GSRunLoopCtxt *ctxt)
|
|||
{
|
||||
if (errno == EINTR)
|
||||
{
|
||||
GSCheckTasks();
|
||||
GSPrivateCheckTasks();
|
||||
poll_return = 0;
|
||||
}
|
||||
else if (errno == 0)
|
||||
|
@ -455,7 +453,7 @@ static void setPollfd(int fd, int event, GSRunLoopCtxt *ctxt)
|
|||
extra: watcher->data
|
||||
forMode: mode];
|
||||
}
|
||||
GSNotifyASAP();
|
||||
GSPrivateNotifyASAP();
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -530,7 +528,7 @@ static void setPollfd(int fd, int event, GSRunLoopCtxt *ctxt)
|
|||
extra: (void*)(uintptr_t)fd
|
||||
forMode: mode];
|
||||
}
|
||||
GSNotifyASAP();
|
||||
GSPrivateNotifyASAP();
|
||||
if (completed == YES)
|
||||
{
|
||||
break; // A nested poll has done the job.
|
||||
|
@ -562,7 +560,7 @@ static void setPollfd(int fd, int event, GSRunLoopCtxt *ctxt)
|
|||
extra: (void*)(uintptr_t)fd
|
||||
forMode: mode];
|
||||
}
|
||||
GSNotifyASAP();
|
||||
GSPrivateNotifyASAP();
|
||||
if (completed == YES)
|
||||
{
|
||||
break; // A nested poll has done the job.
|
||||
|
@ -594,7 +592,7 @@ static void setPollfd(int fd, int event, GSRunLoopCtxt *ctxt)
|
|||
extra: (void*)(uintptr_t)fd
|
||||
forMode: mode];
|
||||
}
|
||||
GSNotifyASAP();
|
||||
GSPrivateNotifyASAP();
|
||||
if (completed == YES)
|
||||
{
|
||||
break; // A nested poll has done the job.
|
||||
|
@ -762,7 +760,7 @@ static void setPollfd(int fd, int event, GSRunLoopCtxt *ctxt)
|
|||
* we can service the queue. Similarly, if a task has completed,
|
||||
* we need to deliver its notifications.
|
||||
*/
|
||||
if (GSCheckTasks() || GSNotifyMore() || immediate == YES)
|
||||
if (GSPrivateCheckTasks() || GSPrivateNotifyMore() || immediate == YES)
|
||||
{
|
||||
timeout.tv_sec = 0;
|
||||
timeout.tv_usec = 0;
|
||||
|
@ -787,7 +785,7 @@ static void setPollfd(int fd, int event, GSRunLoopCtxt *ctxt)
|
|||
{
|
||||
if (errno == EINTR)
|
||||
{
|
||||
GSCheckTasks();
|
||||
GSPrivateCheckTasks();
|
||||
select_return = 0;
|
||||
}
|
||||
else if (errno == 0)
|
||||
|
@ -836,7 +834,7 @@ static void setPollfd(int fd, int event, GSRunLoopCtxt *ctxt)
|
|||
extra: watcher->data
|
||||
forMode: mode];
|
||||
}
|
||||
GSNotifyASAP();
|
||||
GSPrivateNotifyASAP();
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -897,7 +895,7 @@ static void setPollfd(int fd, int event, GSRunLoopCtxt *ctxt)
|
|||
extra: watcher->data
|
||||
forMode: mode];
|
||||
}
|
||||
GSNotifyASAP();
|
||||
GSPrivateNotifyASAP();
|
||||
if (completed == YES)
|
||||
{
|
||||
break;
|
||||
|
@ -929,7 +927,7 @@ static void setPollfd(int fd, int event, GSRunLoopCtxt *ctxt)
|
|||
extra: watcher->data
|
||||
forMode: mode];
|
||||
}
|
||||
GSNotifyASAP();
|
||||
GSPrivateNotifyASAP();
|
||||
if (completed == YES)
|
||||
{
|
||||
break;
|
||||
|
@ -961,7 +959,7 @@ static void setPollfd(int fd, int event, GSRunLoopCtxt *ctxt)
|
|||
extra: watcher->data
|
||||
forMode: mode];
|
||||
}
|
||||
GSNotifyASAP();
|
||||
GSPrivateNotifyASAP();
|
||||
if (completed == YES)
|
||||
{
|
||||
break;
|
||||
|
|
|
@ -2111,52 +2111,71 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
|
|||
{
|
||||
[self setNonBlocking: YES];
|
||||
}
|
||||
if (isSocket) {
|
||||
if (WSAEnumNetworkEvents((SOCKET)_get_osfhandle(descriptor),
|
||||
event, &ocurredEvents) == SOCKET_ERROR)
|
||||
if (isSocket)
|
||||
{
|
||||
NSLog(@"Error getting event type %d", WSAGetLastError());
|
||||
abort();
|
||||
if (WSAEnumNetworkEvents((SOCKET)_get_osfhandle(descriptor),
|
||||
event, &ocurredEvents) == SOCKET_ERROR)
|
||||
{
|
||||
NSLog(@"Error getting event type %d", WSAGetLastError());
|
||||
abort();
|
||||
}
|
||||
if (ocurredEvents.lNetworkEvents & FD_CONNECT)
|
||||
{
|
||||
NSDebugMLLog(@"NSFileHandle", @"Connect on %x", extra);
|
||||
ocurredEvents.lNetworkEvents ^= FD_CONNECT;
|
||||
[self receivedEventWrite];
|
||||
GSPrivateNotifyASAP();
|
||||
}
|
||||
if (ocurredEvents.lNetworkEvents & FD_ACCEPT)
|
||||
{
|
||||
NSDebugMLLog(@"NSFileHandle", @"Accept on %x", extra);
|
||||
ocurredEvents.lNetworkEvents ^= FD_ACCEPT;
|
||||
[self receivedEventRead];
|
||||
GSPrivateNotifyASAP();
|
||||
}
|
||||
if (ocurredEvents.lNetworkEvents & FD_WRITE)
|
||||
{
|
||||
NSDebugMLLog(@"NSFileHandle", @"Write on %x", extra);
|
||||
ocurredEvents.lNetworkEvents ^= FD_WRITE;
|
||||
[self receivedEventWrite];
|
||||
GSPrivateNotifyASAP();
|
||||
}
|
||||
if (ocurredEvents.lNetworkEvents & FD_READ)
|
||||
{
|
||||
NSDebugMLLog(@"NSFileHandle", @"Read on %x", extra);
|
||||
ocurredEvents.lNetworkEvents ^= FD_READ;
|
||||
[self receivedEventRead];
|
||||
GSPrivateNotifyASAP();
|
||||
}
|
||||
if (ocurredEvents.lNetworkEvents & FD_OOB)
|
||||
{
|
||||
NSDebugMLLog(@"NSFileHandle", @"OOB on %x", extra);
|
||||
ocurredEvents.lNetworkEvents ^= FD_OOB;
|
||||
[self receivedEventRead];
|
||||
GSPrivateNotifyASAP();
|
||||
}
|
||||
if (ocurredEvents.lNetworkEvents & FD_CLOSE)
|
||||
{
|
||||
NSDebugMLLog(@"NSFileHandle", @"Close on %x", extra);
|
||||
ocurredEvents.lNetworkEvents ^= FD_CLOSE;
|
||||
if ([writeInfo count] > 0)
|
||||
{
|
||||
[self receivedEventWrite];
|
||||
}
|
||||
else
|
||||
{
|
||||
[self receivedEventRead];
|
||||
}
|
||||
GSPrivateNotifyASAP();
|
||||
}
|
||||
if (ocurredEvents.lNetworkEvents)
|
||||
{
|
||||
NSLog(@"Event not get %d", ocurredEvents.lNetworkEvents);
|
||||
abort();
|
||||
}
|
||||
}
|
||||
if (ocurredEvents.lNetworkEvents & FD_CONNECT)
|
||||
else
|
||||
{
|
||||
NSDebugMLLog(@"NSFileHandle", @"Connect on %x", extra);
|
||||
ocurredEvents.lNetworkEvents ^= FD_CONNECT;
|
||||
[self receivedEventWrite];
|
||||
GSNotifyASAP();
|
||||
}
|
||||
if (ocurredEvents.lNetworkEvents & FD_ACCEPT)
|
||||
{
|
||||
NSDebugMLLog(@"NSFileHandle", @"Accept on %x", extra);
|
||||
ocurredEvents.lNetworkEvents ^= FD_ACCEPT;
|
||||
[self receivedEventRead];
|
||||
GSNotifyASAP();
|
||||
}
|
||||
if (ocurredEvents.lNetworkEvents & FD_WRITE)
|
||||
{
|
||||
NSDebugMLLog(@"NSFileHandle", @"Write on %x", extra);
|
||||
ocurredEvents.lNetworkEvents ^= FD_WRITE;
|
||||
[self receivedEventWrite];
|
||||
GSNotifyASAP();
|
||||
}
|
||||
if (ocurredEvents.lNetworkEvents & FD_READ)
|
||||
{
|
||||
NSDebugMLLog(@"NSFileHandle", @"Read on %x", extra);
|
||||
ocurredEvents.lNetworkEvents ^= FD_READ;
|
||||
[self receivedEventRead];
|
||||
GSNotifyASAP();
|
||||
}
|
||||
if (ocurredEvents.lNetworkEvents & FD_OOB)
|
||||
{
|
||||
NSDebugMLLog(@"NSFileHandle", @"OOB on %x", extra);
|
||||
ocurredEvents.lNetworkEvents ^= FD_OOB;
|
||||
[self receivedEventRead];
|
||||
GSNotifyASAP();
|
||||
}
|
||||
if (ocurredEvents.lNetworkEvents & FD_CLOSE)
|
||||
{
|
||||
NSDebugMLLog(@"NSFileHandle", @"Close on %x", extra);
|
||||
ocurredEvents.lNetworkEvents ^= FD_CLOSE;
|
||||
if ([writeInfo count] > 0)
|
||||
{
|
||||
[self receivedEventWrite];
|
||||
|
@ -2165,23 +2184,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
|
|||
{
|
||||
[self receivedEventRead];
|
||||
}
|
||||
GSNotifyASAP();
|
||||
}
|
||||
if (ocurredEvents.lNetworkEvents)
|
||||
{
|
||||
NSLog(@"Event not get %d", ocurredEvents.lNetworkEvents);
|
||||
abort();
|
||||
}
|
||||
} else {
|
||||
if ([writeInfo count] > 0)
|
||||
{
|
||||
[self receivedEventWrite];
|
||||
}
|
||||
else
|
||||
{
|
||||
[self receivedEventRead];
|
||||
}
|
||||
GSNotifyASAP();
|
||||
GSPrivateNotifyASAP();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -17,8 +17,6 @@
|
|||
#include <Foundation/NSPort.h>
|
||||
#include <Foundation/NSStream.h>
|
||||
|
||||
extern BOOL GSCheckTasks();
|
||||
|
||||
#if GS_WITH_GC == 0
|
||||
static SEL wRelSel;
|
||||
static SEL wRetSel;
|
||||
|
@ -375,7 +373,7 @@ static const NSMapTableValueCallBacks WatcherMapValueCallBacks =
|
|||
* we can service the queue. Similarly, if a task has completed,
|
||||
* we need to deliver its notifications.
|
||||
*/
|
||||
if (GSCheckTasks() || GSNotifyMore() || immediate == YES)
|
||||
if (GSPrivateCheckTasks() || GSPrivateNotifyMore() || immediate == YES)
|
||||
{
|
||||
wait_timeout = 0;
|
||||
}
|
||||
|
@ -493,7 +491,7 @@ static const NSMapTableValueCallBacks WatcherMapValueCallBacks =
|
|||
extra: watcher->data
|
||||
forMode: mode];
|
||||
}
|
||||
GSNotifyASAP();
|
||||
GSPrivateNotifyASAP();
|
||||
}
|
||||
|
||||
// if there are windows message
|
||||
|
@ -545,7 +543,7 @@ static const NSMapTableValueCallBacks WatcherMapValueCallBacks =
|
|||
forMode: mode];
|
||||
}
|
||||
|
||||
GSNotifyASAP();
|
||||
GSPrivateNotifyASAP();
|
||||
|
||||
completed = YES;
|
||||
return YES;
|
||||
|
|
Loading…
Reference in a new issue