ObjFW  Diff

Differences From Artifact [b0b3935794]:

  • File src/OFKernelEventObserver.h — part of check-in [c5f0c5f9ba] at 2015-12-29 21:42:38 on branch 0.8 — Refactor OFKernelEventObserver

    This moves the locked queue for actions to
    OFKernelEventObserver_LockedQueue, which is now used for select and
    poll, but skipped for kqueue and epoll, as they natively support changes
    from another thread.

    This fixes the problem that removing an object is delayed until the next
    observe call - at which point it might have already been closed, meaning
    the fd is no longer available. This was mainly a problem with kqueue, as
    closing the fd already removed it from the kqueue, which then resulted
    in an error being returned when trying to manually remove the fd from
    the kqueue. (user: js, size: 6821) [annotate] [blame] [check-ins using]

To Artifact [f92733e89e]:


18
19
20
21
22
23
24



25
26
27
28
29
30
31

#import "socket.h"

OF_ASSUME_NONNULL_BEGIN

@class OFMutableArray OF_GENERIC(ObjectType);
@class OFDate;




/*!
 * @protocol OFKernelEventObserverDelegate
 *	     OFKernelEventObserver.h ObjFW/OFKernelEventObserver.h
 *
 * @brief A protocol that needs to be implemented by delegates for
 *	  OFKernelEventObserver.







>
>
>







18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34

#import "socket.h"

OF_ASSUME_NONNULL_BEGIN

@class OFMutableArray OF_GENERIC(ObjectType);
@class OFDate;
#ifdef OF_HAVE_THREADS
@class OFMutex;
#endif

/*!
 * @protocol OFKernelEventObserverDelegate
 *	     OFKernelEventObserver.h ObjFW/OFKernelEventObserver.h
 *
 * @brief A protocol that needs to be implemented by delegates for
 *	  OFKernelEventObserver.
111
112
113
114
115
116
117



118
119
120
121
122
123
124
	    *_writeObjects;
	id <OFKernelEventObserverDelegate> _delegate;
#ifdef OF_HAVE_PIPE
	int _cancelFD[2];
#else
	of_socket_t _cancelFD[2];
	struct sockaddr_in _cancelAddr;



#endif
}

#ifdef OF_HAVE_PROPERTIES
@property OF_NULLABLE_PROPERTY (assign)
    id <OFKernelEventObserverDelegate> delegate;
#endif







>
>
>







114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
	    *_writeObjects;
	id <OFKernelEventObserverDelegate> _delegate;
#ifdef OF_HAVE_PIPE
	int _cancelFD[2];
#else
	of_socket_t _cancelFD[2];
	struct sockaddr_in _cancelAddr;
#endif
#ifdef OF_HAVE_THREADS
	OFMutex *_mutex;
#endif
}

#ifdef OF_HAVE_PROPERTIES
@property OF_NULLABLE_PROPERTY (assign)
    id <OFKernelEventObserverDelegate> delegate;
#endif