Norman Maurer
c40c6e1222
Add support to obtain the current EventLoop ( #120 )
...
Motivation:
In certain cases it would be useful to be able to access the current EventLoop (which is tied to a thread).
Modifications:
- Add MultiThreadEventLoopGroup.currentEventLoop
- Add tests
Result:
Fixes [#59 ]
2018-03-15 16:05:35 +01:00
sun_
2a9e2d6660
Small cleanup in EventLoop. ( #96 )
...
Motivation:
Cleaner code.
Modifications:
Change () throws -> (T) to () throws -> T
Result:
Cleaner code.
2018-03-04 06:58:20 -08:00
adamnemecek
0bbed6d72f
* removed trailing whitespace ( #52 )
2018-03-02 15:40:52 +09:00
Norman Maurer
d74dda7439
Remove Channel.open and rename Selectable.open to isOpen ( #19 )
...
Motivation:
Channel.open was not really needed as for our use-case Selectable already provides everything we need. Also how we used Channel.open in some scenarios was not really correct.
Modifications:
- Remove extension method.
- Rename property
- Remove out-dated comment.
- Fix usage of open
Result:
More clear and correct API
2018-02-27 09:34:26 +09:00
Johannes Weiß
73a805c7f6
minor stylistic improvements ( #36 )
...
Motivation:
Sometimes we deviated from the style the Swift stdlib sets out for no
reason.
Modifications:
Fixed some stylistic deviations.
Result:
Looks more Swift-like.
2018-02-26 15:52:49 +00:00
Johannes Weiss
26582a3e97
redundant let elimination
...
Motivation:
`let _ = ...` is redundant and should be `_ =`
Modifications:
removed redundant `let`s
Result:
saved disk space ;)
2018-02-19 17:41:52 +00:00
Johannes Weiss
4a09182a39
rewrite closures that just ignore their parameter & change whenComplete
...
to not return a value
Motivation:
We recently had a bug where we had `EventLoopFuture<EventLoopFuture<()>>` which didn't make any sense. The compiler couldn't catch that problem because we just ignored a closure's argument like this:
future.then { _ in
...
}
which is dangerous. For closures that take an empty tuple, the `_ in`
isn't actually required and the others should state the type they want
to ignore.
And most whenComplete calls can be better (and often shorter) expressed
by other combinators.
Modifications:
remove pretty much all closures which just blanket ignore their
parameter.
Result:
- no closures which just ignore their parameter without at least stating
its type.
- rewrote all whenCompletes that actually used the value
2018-02-16 17:28:43 +00:00
Cory Benfield
ab9427bdd4
Initial UDP support
2018-01-16 17:00:09 +00:00
Cory Benfield
67bb71e44b
Add a pending datagram writes manager
...
This change adds support for doing datagram-style writes. It's not currently
hooked up to anything, but it will be sometime soon.
2018-02-14 15:32:31 +00:00
Johannes Weiß
dba0a5379c
fix longstanding typo in newSucceededFuture
...
Motivation:
We used to have a method `newSucceedFuture` which should be
`newSucceededFuture`
Modifications:
grammar
Result:
better grammar
2018-02-13 09:55:33 +00:00
Johannes Weiß
11a609396d
don't blow up when holding onto a ChannelPipeline of a deinitialised Channel
2018-02-09 14:53:09 +00:00
Johannes Weiss
734904d0f4
clean up the (proto)types for EventLoopFuture
...
* clean up the (proto)types for EventLoopFuture
* Remove more unnecessary parens
2018-02-09 16:03:28 +00:00
Norman Maurer
995177fbc6
Support setting Thread affinity and use it with EventLoopGroups
2018-02-06 16:08:57 +01:00
Cory Benfield
3768e2a2b9
Don't allow registration on shutting down loops
2018-02-08 10:25:47 +00:00
Johannes Weiß
32bb597c24
remove Int extension we do not need
2018-02-06 12:30:27 +00:00
Norman Maurer
e1bf447a9a
Replace usage of Foundation.Thread with our own Thread that just used…
...
* Replace usage of Foundation.Thread with our own Thread that just used pthread
* Address comments
* some more docs / comments
* Address comments of cory
2018-02-06 11:45:57 +01:00
Johannes Weiss
4a2425f5b7
promise leak debugging
2018-01-24 08:21:35 +00:00
Johannes Weiß
c79c5ba364
re-export Darwin/Glibc and reduce number of #if os(...)
2018-01-09 15:08:17 +00:00
Johannes Weiss
34e0b1ac0a
sanitise time interval (aka TimeAmount) APIs
2018-01-08 15:41:40 +00:00
Johannes Weiss
246bd7e56f
EventLoop and EventLoopGroup should be class bound
2018-01-04 17:41:10 +00:00
Johannes Weiß
94e1af5452
compile warning-free on Swift 4.1
2017-12-18 15:37:57 +00:00
Johannes Weiß
25f4e2ceff
PriorityQueue: make it work for partial orders
2017-12-12 11:13:33 +00:00
Johannes Weiss
64a1c2feb8
Channel writes: unit tests & lots of fixes
2017-12-11 12:20:46 +00:00
Norman Maurer
2bfd69b980
Add docs for EventLoop
...
* Add docs for EventLoop
* Address comments
2017-12-05 13:54:12 +01:00
Johannes Weiss
8335b6c3a0
replace priority queue
2017-11-28 16:13:26 +00:00
Johannes Weiß
06f9b1d63b
merge ConcurrencyHelpers
2017-11-21 18:32:33 +00:00
Johannes Weiß
33fe401322
rename Future/Promise to EventLoopFuture/EventLoopPromise
2017-11-21 17:41:36 +00:00
Max (Swift) Moiseev
198d6b447b
Explicit access modifiers on members in extensions
2017-11-18 04:40:26 -08:00
Max Moiseev
01b28a3f6d
Simplify logic in guards (replace some with ifs instead)
2017-11-16 17:29:35 -08:00
Cory Benfield
1cb736e370
Catch bugs with sync shutdown
2017-11-10 17:28:52 +00:00
Johannes Weiß
31cd14eaad
fix inEventLoop race and makes TSan happy
2017-11-10 14:56:33 -08:00
Norman Maurer
9c7829a065
Port IdleStateHandler from Netty
2017-10-29 09:46:48 +01:00
Johannes Weiss
3bef8a4012
turn import Foundation comments into code :)
2017-10-12 16:33:50 +01:00
Johannes Weiss
1adb581f59
remove more Foundation imports
2017-10-10 16:25:43 +01:00
Cory Benfield
3b40563a5e
Prevent hot loop starving I/O
2017-10-09 18:14:49 -07:00
Johannes Weiß
8e06697362
fix EventLoop shutdown by introducing shutdownGracefully
2017-09-20 17:15:06 +01:00
Johannes Weiß
1b46d7c4ba
fix ScheduledTask's Comparable implementation
2017-09-20 17:57:31 +01:00
Johannes Weiss
6721d46b9d
make scheduling tasks on the EventLoop compatible with the tail call syntax
2017-09-18 16:24:08 +01:00
Norman Maurer
ca7aac3253
Allow to cancel scheduled tasks
2017-08-18 14:07:17 +02:00
Norman Maurer
351d7c40d5
Cleanup code and remove old comments
2017-08-17 19:29:11 +02:00
Norman Maurer
b2405eac44
Add support to schedule tasks on the EventLoop
2017-08-17 13:50:32 +02:00
Norman Maurer
4f91fe3f65
Fix possible infinite recursive loop when deregistering from the Selector throws an error while in close0 method
2017-08-16 19:36:50 +02:00
Johannes Weiß
06ff146839
fix missing autoreleasepool & faster string -> bytes
2017-07-17 17:57:15 +01:00
Norman Maurer
ef4cabc4b1
Ensure we not hold a lock while executing the tasks submitted to the EventLoop
2017-07-06 19:53:22 +02:00
Norman Maurer
4b1bc0afa9
EventLoop.submit(...) should use newPromise() for its promise creation to make it easer to implement
2017-07-04 20:10:45 +02:00
Norman Maurer
fd936557c4
Move Socket/* into NIO/ for max performance
...
Before:
`Bandwidth per channel: 18870.319⇅ Mbps (2358789.8 kBps)`
After:
`Bandwidth per channel: 21330.617⇅ Mbps (2666327.1 kBps)`
2017-07-03 14:52:09 +02:00
Norman Maurer
6e55eb0ade
Rename InterestedEvent to IOEvent and reuse it in SelectorEvent to make things more consistent
2017-07-03 13:24:02 +02:00
Norman Maurer
851296002e
Simplify code and some cleanup
2017-07-02 09:12:16 +02:00
Norman Maurer
c7dd20e9ba
Cheaper way of creating fullfilled futures
2017-07-01 20:19:42 +02:00
Johannes Weiß
d9daac64cc
make registration type-safe
2017-06-27 15:58:22 +01:00