ObjFW  History of src/OFKernelEventObserver.m of 38c16e3793a2a175

History of file src/OFKernelEventObserver.m at check-in 38c16e3793a2a175

2024-08-17
17:30
Delay socket initialization as long as possible

On game consoles, initializing sockets takes a significant amount of
time. When not delaying socket initializing, that time is spent during
startup even when the application might never use sockets.

Worse yet, on Amiga, sockets might not be available at all and the
application will fail to start up, even when the application might never
use sockets. file: [6e35982883] check-in: [7460d2ccd8] user: js, branch: trunk, size: 6584 [annotate] [blame] [check-ins using] [diff]

2024-07-29
22:19
Fix missing underscore in last commit file: [370fb61e6e] check-in: [c9bf16250c] user: js, branch: trunk, size: 6653 [annotate] [blame] [check-ins using] [diff]
19:41
-[OFKernelEventObserver cancel]: Handle EINTR file: [9e9d5309f1] check-in: [ed598fd848] user: js, branch: trunk, size: 6651 [annotate] [blame] [check-ins using] [diff]
2024-04-29
21:42
Properly hide private symbols file: [0c63190dd8] check-in: [f16bccc7b3] user: js, branch: trunk, size: 6455 [annotate] [blame] [check-ins using] [diff]
2024-04-03
02:16
Change license to LGPLv3 only file: [c5333a4c56] check-in: [7413a728a7] user: js, branch: trunk, size: 6452 [annotate] [blame] [check-ins using] [diff]
2024-04-01
15:59
Remove #define __NO_EXT_QNX

It doesn't seem to be needed anymore. file: [d1c33bf38e] check-in: [cf0effe834] user: js, branch: trunk, size: 6244 [annotate] [blame] [check-ins using] [diff]

2024-02-03
11:41
Update copyright file: [97a87808e7] check-in: [7324ec8590] user: js, branch: 1.0, size: 6207 [annotate] [blame] [check-ins using] [diff]
2024-01-02
17:17
Update copyright file: [fd95409b3f] check-in: [26ddd2e4e4] user: js, branch: trunk, size: 6266 [annotate] [blame] [check-ins using] [diff]
2023-10-15
12:32
Add -[OFStream lowlevelIsAtEndOfStream]

This allows for a much cleaner solution to avoid the internal read
buffer of e.g. a TLS connection never being processed while waiting for
a delimiter. file: [d1361f5797] check-in: [a61e0594b4] user: js, branch: trunk, size: 6266 [annotate] [blame] [check-ins using] [diff]

2023-04-10
15:08
Work around newer amiga-gcc defining Class file: [65045f52e2] check-in: [abbed5c008] user: js, branch: trunk, size: 6207 [annotate] [blame] [check-ins using] [diff]
2023-01-06
09:04
Update copyright file: [f0b8cf939e] check-in: [8939cbdb52] user: js, branch: trunk, size: 6163 [annotate] [blame] [check-ins using] [diff]
2022-02-12
07:46
Update copyright file: [8d008316fd] check-in: [1a86b8175b] user: js, branch: trunk, size: 6163 [annotate] [blame] [check-ins using] [diff]
2021-04-19
22:20
Rename all remaining enums file: [bc5e41d427] check-in: [e97b03815f] user: js, branch: new-naming-convention, size: 6163 [annotate] [blame] [check-ins using] [diff]
2021-04-18
23:18
INVALID_SOCKET -> OFInvalidSocketHandle file: [c8344a220c] check-in: [4b587c8874] user: js, branch: new-naming-convention, size: 6291 [annotate] [blame] [check-ins using] [diff]
22:56
Rename all symbols marked extern file: [1b43b5b3cb] check-in: [e73c65a849] user: js, branch: new-naming-convention, size: 6284 [annotate] [blame] [check-ins using] [diff]
20:51
Rename everything in several smaller files file: [66fc5201d9] check-in: [35de667566] user: js, branch: new-naming-convention, size: 6289 [annotate] [blame] [check-ins using] [diff]
15:55
Rename all functions in macros.h file: [babf71ff85] check-in: [7392685ffc] user: js, branch: new-naming-convention, size: 6287 [annotate] [blame] [check-ins using] [diff]
2021-04-17
00:51
of_time_interval_t -> OFTimeInterval file: [4e64aadcfc] check-in: [8c0d76f782] user: js, branch: new-naming-convention, size: 6291 [annotate] [blame] [check-ins using] [diff]
2021-01-02
22:04
Update copyright file: [9d77b8881b] check-in: [374e1a1bfa] user: js, branch: trunk, size: 6295 [annotate] [blame] [check-ins using] [diff]
2020-11-29
02:44
OFKernelEventObserver: Reorder #ifdefs

Check for AmigaOS first, as we have a special implementation for it that
uses WaitSelect() instead. This way, we no longer need to match $host_os
to manually disable the pipe() check, which would break if one of the
AmigaOS variants adds pipe() later on. file: [451fcb3cdf] check-in: [d76213374e] user: js, branch: trunk, size: 6384 [annotate] [blame] [check-ins using] [diff]

2020-10-31
18:27
OFKernelEventObserver: Allow mutation in observe file: [0cbb2bba17] check-in: [0b478d8138] user: js, branch: trunk, size: 6336 [annotate] [blame] [check-ins using] [diff]
2020-06-28
15:03
Use OF_DIRECT(_MEMBERS) where appropriate file: [58babda954] check-in: [b6cb3addd0] user: js, branch: trunk, size: 6238 [annotate] [blame] [check-ins using] [diff]
2020-01-07
22:59
OFKernelEventObserver: Fix read buffers, select() file: [2c737f6572] check-in: [23ff70bec4] user: js, branch: trunk, size: 6226 [annotate] [blame] [check-ins using] [diff]
20:28
OFKernelEventObserver: Remove queueing of actions

This removes the ability to let a thread add or remove objects for
another thread. This features wasn't used at all, but caused significant
problems with kqueue and epoll, as this often resulted in removing a
file descriptor after it had already been closed. file: [6cc4e842a3] check-in: [24eff635db] user: js, branch: trunk, size: 6160 [annotate] [blame] [check-ins using] [diff]

2020-01-02
01:51
Update copyright file: [fac1be8914] check-in: [c7f0229795] user: js, branch: trunk, size: 9301 [annotate] [blame] [check-ins using] [diff]
2019-09-01
15:20
Use u suffix on a few constants file: [836f39f0f7] check-in: [b7badc68a0] user: js, branch: trunk, size: 9298 [annotate] [blame] [check-ins using] [diff]
2019-08-31
17:13
Make -[OFKernelEventObserver cancel] work on Amiga file: [d45077c20a] check-in: [8941b1d974] user: js, branch: trunk, size: 9296 [annotate] [blame] [check-ins using] [diff]
12:40
OFKernelEventObserver: Support for Exec Signals file: [6f6bd90234] check-in: [e9eb87694a] user: js, branch: trunk, size: 9004 [annotate] [blame] [check-ins using] [diff]
2019-08-09
23:44
Support sockets on AmigaOS 3 file: [8f3db9a0ca] check-in: [3dec8ecf2e] user: js, branch: trunk, size: 8933 [annotate] [blame] [check-ins using] [diff]
2019-06-17
02:33
Remove underscores from class names file: [b61a7255dc] check-in: [17d57e01ff] user: js, branch: trunk, size: 8951 [annotate] [blame] [check-ins using] [diff]
2019-03-08
00:35
Use dot syntax file: [68149c85a6] check-in: [bceb7ed4c9] user: js, branch: trunk, size: 8959 [annotate] [blame] [check-ins using] [diff]
2019-01-03
19:13
Update copyright file: [97baff6c86] check-in: [0509d7a844] user: js, branch: trunk, size: 8973 [annotate] [blame] [check-ins using] [diff]
2018-01-03
19:49
Update copyright notice file: [3b2e1e8697] check-in: [7e5c81e186] user: js, branch: trunk, size: 8967 [annotate] [blame] [check-ins using] [diff]
2017-10-17
00:33
Do not use implicit method return types

Instead, explicitly declare them, as OF_ASSUME_NONNULL_{BEGIN,END} does
not apply to implicit return types. This means that after this commit,
all init methods have a nonnull return type, as they should have. file: [10e66eceba] check-in: [2f4e0df8be] user: js, branch: trunk, size: 8944 [annotate] [blame] [check-ins using] [diff]

2017-07-22
20:50
Split OFDataArray into OFData and OFMutableData file: [c21bd55fb9] check-in: [c8f7b90082] user: js, branch: trunk, size: 8916 [annotate] [blame] [check-ins using] [diff]
2017-05-21
23:57
Use closesocket() instead of close()

Previously, socket_helpers.h would just define close() to whatever is
needed to close a socket. However, this makes it possible to
accidentally call a socket-specific close on something that is not a
socket. Having to explicitly call closesocket() (and defining it to
close() on platforms where it's the same) prevents this. file: [01c61511ac] check-in: [b4cd87cd81] user: js, branch: trunk, size: 8919 [annotate] [blame] [check-ins using] [diff]

21:28
Prefix private methods with of_ instead of OF_

This matches Apple's style. file: [1a2dbaaf85] check-in: [6b77a5dd8b] user: js, branch: trunk, size: 8794 [annotate] [blame] [check-ins using] [diff]

20:13
OFKernelEventObserver: #if HAVE_* -> #ifdef HAVE_* file: [9bc4c1ecdf] check-in: [32e8c1ee4c] user: js, branch: trunk, size: 8794 [annotate] [blame] [check-ins using] [diff]
20:03
Cast several socket-related arguments to void *

This is required to make it work on MorphOS with -noixemul, as socket
functions take UBYTE * arguments instead then, resulting in a warning
about signedness because char is signed. file: [75fadf5f06] check-in: [c658e97994] user: js, branch: trunk, size: 8788 [annotate] [blame] [check-ins using] [diff]

2017-05-17
20:31
configure: Better poll() and select() checks file: [57631eb71f] check-in: [a29197bd35] user: js, branch: trunk, size: 8763 [annotate] [blame] [check-ins using] [diff]
2017-05-07
20:10
Small code style change

Casts are now written like types in variable declarations. file: [687f558fe2] check-in: [4af49a13c3] user: js, branch: trunk, size: 8881 [annotate] [blame] [check-ins using] [diff]

2017-01-09
17:36
Update copyright

Forgot to add 2017, even though I already did quite some changes in
2017. file: [02536e25d0] check-in: [44f45c2e35] user: js, branch: trunk, size: 8868 [annotate] [blame] [check-ins using] [diff]

2016-03-27
23:10
Add socket support for Nintendo 3DS

This removes the port registry that existed for the Wii and instead
tries binding to random ports in a loop until it succeeds or errno is
not EADDRINUSE. This is done for the Wii and Nintendo 3DS now.

This also includes several other socket-related cleanups. file: [abf69b00a7] check-in: [12b8a7552e] user: js, branch: trunk, size: 8862 [annotate] [blame] [check-ins using] [diff]

2016-03-20
14:19
Use the locked queue for kqueue and epoll as well

_readObjects must only be changed from the thread running the observer
and not from a thread adding or removing objects to observe. This is
already handled by the locked queue used by poll and select, so the best
way to solve this is to use the locked queue for kqueue and epoll as
well. file: [2f243bf470] check-in: [85917ea0dd] user: js, branch: 0.8, size: 8743 [annotate] [blame] [check-ins using] [diff]

14:07
Use the locked queue for kqueue and epoll as well

_readObjects must only be changed from the thread running the observer
and not from a thread adding or removing objects to observe. This is
already handled by the locked queue used by poll and select, so the best
way to solve this is to use the locked queue for kqueue and epoll as
well. file: [e992bd3e10] check-in: [45518ae7b7] user: js, branch: trunk, size: 8571 [annotate] [blame] [check-ins using] [diff]

12:05
Never block when the read buffer is non-empty

This was broken by 88f2f03. The problem only existed when something was
in the read buffer, but not processed completely, as after processing
the read buffer, it would go on to wait for data - but since not the
entire read buffer had been processed, it meant there was still data
left there that needed to be handled first. file: [b44fb07041] check-in: [b84490ab4f] user: js, branch: 0.8, size: 5712 [annotate] [blame] [check-ins using] [diff]

11:57
Never block when the read buffer is non-empty

This was broken by 88f2f03. The problem only existed when something was
in the read buffer, but not processed completely, as after processing
the read buffer, it would go on to wait for data - but since not the
entire read buffer had been processed, it meant there was still data
left there that needed to be handled first. file: [1613a72d1b] check-in: [7ae17af9f0] user: js, branch: trunk, size: 5487 [annotate] [blame] [check-ins using] [diff]

2016-01-03
01:14
Make more use of fast enumeration file: [5d44afb3d5] check-in: [cb0fd980f9] user: js, branch: trunk, size: 5288 [annotate] [blame] [check-ins using] [diff]
00:43
Update copyright

While at it, also update the mail address. file: [74500121cd] check-in: [cec0f072f8] user: js, branch: 0.8, size: 5514 [annotate] [blame] [check-ins using] [diff]

00:41
Update copyright

While at it, also update the mail address. file: [39f30ed249] check-in: [2a27cf3000] user: js, branch: trunk, size: 5387 [annotate] [blame] [check-ins using] [diff]

00:36
Fix a regression from the previous refactorization

kqueue and epoll were not updating _readObjects and _writeObjects
anymore, since this was done by the queue handling code, which they no
longer use after the refactorization. file: [5076db7548] check-in: [d1c4c46706] user: js, branch: 0.8, size: 5510 [annotate] [blame] [check-ins using] [diff]

00:35
Fix a regression from the previous refactorization

kqueue and epoll were not updating _readObjects and _writeObjects
anymore, since this was done by the queue handling code, which they no
longer use after the refactorization. file: [952d94c390] check-in: [258b8a4944] user: js, branch: trunk, size: 5383 [annotate] [blame] [check-ins using] [diff]

2015-12-29
21:42
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. file: [8054f8aa66] check-in: [c5f0c5f9ba] user: js, branch: 0.8, size: 5343 [annotate] [blame] [check-ins using] [diff]

21:33
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. file: [898e307ee4] check-in: [e9b4700cb6] user: js, branch: trunk, size: 5216 [annotate] [blame] [check-ins using] [diff]

2015-11-29
11:43
Make properties a requirement and clean up code

This increases the required GCC version from 4.0 to 4.6 (exception:
Apple GCC, which already supports this with >= 4.0 starting with OS X
10.5). Since even GCC 4.6 is really old by now, there is no point in
still supporting something even older and making the code ugly because
of that. While some hardware and OS support was dropped from GCC 4.6
compared to GCC 4.0, there is nothing in there that would be an
interesting target with the exception of BeOS maybe - but a port to BeOS
can also be achieved using the Haiku support. The other dropped OSes are
mostly old versions of OSes while newer ones are still being supported
(and those newer versions of those OSes still support the same
hardware). file: [d6c5a9d524] check-in: [48980f2297] user: js, branch: trunk, size: 8050 [annotate] [blame] [check-ins using] [diff]

2015-10-19
22:15
Add platform.h & make platform defines consistent file: [6ae3a0050f] check-in: [1ba08eebc5] user: js, branch: trunk, size: 8180 [annotate] [blame] [check-ins using] [diff]
2015-10-17
10:59
Add a port registry for the Wii

This is necessary as the Wii does not allow picking a random free port,
and thus we need to track which ports are used. file: [23a24b058b] check-in: [ed4549ddd3] user: js, branch: trunk, size: 8179 [annotate] [blame] [check-ins using] [diff]

2015-10-04
11:11
Special cases for the Wii's weird network stack

This fixes the tests on Wii. file: [b0c771eac2] check-in: [4cecf82254] user: js, branch: trunk, size: 8177 [annotate] [blame] [check-ins using] [diff]

2015-05-09
18:13
More OFKernelEventObserver refactoring

This was necessary because select(), poll() and kevent() on FreeBSD and
OS X would sometimes return 0 events, even if there are some, and
sometimes return the correct number of events that were pending, meaning
the number of events returned is unreliable. To make things worse,
whether it returns 0 or the number of events that were pending is
completely non-deterministic on both FreeBSD and OS X (running the same
tests multiple times in a row would make it sometimes work and sometimes
fail).

In order to prevent code from depending on the return value of
-[observeForTimeInterval:] (which would depend on select(), poll() and
kevent() returning the correct number), OFKernelObserver no longer
returns whether there were pending events. It is expected that
-[observe] or -[observeForTimeInterval:] is just called in a loop as
long as events should be handled.

The tests have been changed as well to reflect this. What they do now is
set a deadline and call -[observeForTimeInterval:] with a small timeout
in a loop until the deadline is reached or all events have been handled.

Note: DragonFlyBSD has not been tested, but will most likely behave like
FreeBSD and OS X. file: [b099b55bf8] check-in: [220513a3f5] user: js, branch: trunk, size: 7927 [annotate] [blame] [check-ins using] [diff]

2015-05-04
20:34
Refactor OFKernelEventObserver file: [80d7681218] check-in: [bbe4040126] user: js, branch: trunk, size: 8160 [annotate] [blame] [check-ins using] [diff]
14:30
Add OFKernelEventObserver_epoll file: [566a494d67] check-in: [ed4a6f396b] user: js, branch: trunk, size: 9243 [annotate] [blame] [check-ins using] [diff]
2015-04-26
10:42
OFKernelEventObserver: Keep FD -> object mapping

Removing the FD from the FD -> object mapping results in
OF_processReadBuffers passing nil to objectIsReadyForReading: if there's
still something in the read buffer.

Additionally, this also broke when observing the same object for reading
and writing and then removing it for either reading or writing. file: [57b253b8a0] check-in: [f9ceddcb7d] user: js, branch: trunk, size: 9210 [annotate] [blame] [check-ins using] [diff]

10:40
OFKernelEventObserver: Rename a private method file: [6b86d2ab72] check-in: [bd05eb8de3] user: js, branch: trunk, size: 9128 [annotate] [blame] [check-ins using] [diff]
2015-04-14
19:34
OFKernelEventObserver*.m: Minor cleanup file: [628ba88c27] check-in: [5924cc3a92] user: js, branch: trunk, size: 9101 [annotate] [blame] [check-ins using] [diff]
2015-02-18
22:56
Add of_getsockname() and make use of it

of_getsockname() calls getsockname() after acquiring a mutex. This is
necessary as some implementations of getsockname() are not thread-safe. file: [e8b15decf5] check-in: [f18615e057] user: js, branch: trunk, size: 9103 [annotate] [blame] [check-ins using] [diff]

2015-02-16
08:39
Explicitly pass errno to exceptions

The old behaviour where the exception would access errno directly on
creation of the exception was very fragile. The two main problems with
it were that sometimes it would pick up an errno even though none had
been set and in other cases that when the exception was created errno
had already been overridden.

This also greatly increases errno handling on Win32, especially in
conjunction with sockets. It can still be improved further, though. file: [83e01ba01e] check-in: [62e2de30b9] user: js, branch: trunk, size: 9076 [annotate] [blame] [check-ins using] [diff]

2015-01-03
20:57
Update copyright file: [d24665c090] check-in: [cfd374b906] user: js, branch: trunk, size: 9077 [annotate] [blame] [check-ins using] [diff]
2014-08-22
19:09
Retain sockets until after removal from observer

Not retaining them caused kevent() to be called on an invalid fd. file: [3ffd7510cd] check-in: [1dbe9a4e4e] user: js, branch: trunk, size: 9071 [annotate] [blame] [check-ins using] [diff]

2014-06-21
21:43
Move all macros from OFObject.h to macros.h

This means that OFObject.h imports macros.h now, making it unnecessary
to manually import macros.h in almost every file. And while at it, also
import autorelease.h in OFObject.h, so that this doesn't need to be
manually imported in almost every file as well. file: [380728b304] check-in: [13ee56edf3] user: js, branch: trunk, size: 8962 [annotate] [blame] [check-ins using] [diff]

2014-06-16
15:06
Make return type of -[OFArray objects] const

After all, this might (and does for OFArray_adjacent!) return an
internal representation that must not be changed, so changes should be
prevented at compile-time. file: [cb71953a13] check-in: [68d32a92c1] user: js, branch: trunk, size: 9005 [annotate] [blame] [check-ins using] [diff]

2014-05-31
17:57
OFStream: Add -[hasDataInReadBuffer].

This replaces -[numberOfBytesInReadBuffer], as it's not always known how
many bytes there are exactly and thus the number would often be wrong
(e.g. because data is compressed). file: [fb20fdd1d1] check-in: [acc999a75e] user: js, branch: trunk, size: 8993 [annotate] [blame] [check-ins using] [diff]

2014-03-05
00:34
OFKernelEventObserver: Only use 1 internal socket file: [2dacb355e7] check-in: [a2f2a3289d] user: js, branch: trunk, size: 9003 [annotate] [blame] [check-ins using] [diff]
2014-02-18
00:22
Move around a few defines to be more consistent file: [a663dc04e8] check-in: [f9d12201f8] user: js, branch: trunk, size: 9215 [annotate] [blame] [check-ins using] [diff]
2014-02-04
09:41
OFKernelEventObserver_kqueue: Ignore EBADF

Removed file descriptors were returned in the event list with EBADF if
the file descriptor has been closed before removing them. Interpreting
that as a read event caused problems, as the file descriptor could not
be mapped to an object anymore, thus the entry in the event list is
skipped now if there was a EBADF error. file: [8aa249806a] check-in: [41ca862453] user: js, branch: trunk, size: 9215 [annotate] [blame] [check-ins using] [diff]

2014-02-03
19:11
OFKernelEventObserver: Fix a typo file: [5a67a78a49] check-in: [678dd1cdc7] user: js, branch: trunk, size: 9215 [annotate] [blame] [check-ins using] [diff]
14:43
Move socket initialization to a single place file: [e92efb6b43] check-in: [414c87ec13] user: js, branch: trunk, size: 9216 [annotate] [blame] [check-ins using] [diff]
2014-01-29
15:54
Generalize OFKernelEventObserver

It is no longer limited to streams now. file: [71bb648f05] check-in: [c694569d86] user: js, branch: trunk, size: 9111 [annotate] [blame] [check-ins using] [diff]

2014-01-28
22:50
Added: Rename OFStreamObserver -> OFKernelEventObserver file: [106e3c4be1] check-in: [96e20b8093] user: js, branch: trunk, size: 8964 [annotate] [blame] [check-ins using]