summaryrefslogtreecommitdiff
path: root/Libraries/LibCore/EventLoop.cpp
AgeCommit message (Collapse)Author
2020-11-15Everywhere: Add missing <AK/ByteBuffer.h> includesAndreas Kling
All of these files were getting ByteBuffer.h from someone else and then using it. Let's include it explicitly.
2020-11-10AK: Make RefPtr, NonnullRefPtr, WeakPtr thread safeTom
This makes most operations thread safe, especially so that they can safely be used in the Kernel. This includes obtaining a strong reference from a weak reference, which now requires an explicit call to WeakPtr::strong_ref(). Another major change is that Weakable::make_weak_ref() may require the explicit target type. Previously we used reinterpret_cast in WeakPtr, assuming that it can be properly converted. But WeakPtr does not necessarily have the knowledge to be able to do this. Instead, we now ask the class itself to deliver a WeakPtr to the type that we want. Also, WeakLink is no longer specific to a target type. The reason for this is that we want to be able to safely convert e.g. WeakPtr<T> to WeakPtr<U>, and before this we just reinterpret_cast the internal WeakLink<T> to WeakLink<U>, which is a bold assumption that it would actually produce the correct code. Instead, WeakLink now operates on just a raw pointer and we only make those constructors/operators available if we can verify that it can be safely cast. In order to guarantee thread safety, we now use the least significant bit in the pointer for locking purposes. This also means that only properly aligned pointers can be used.
2020-10-17LibCore: Use new format functions in some places.asynts
2020-09-11LibCore: Fixed DeferredInvoke debug message (#3456)pkotzbach
2020-09-09LibCore: Add 'notify_forked()' to tear down the eventloop in forked childAnotherTest
This makes the forked process capable of constructing a new event loop, should it choose to.
2020-07-09LibCore: Add register_signal and unregister_signal to EventLoopTom
This allows safer asynchronous handling of signals. Signals are dispatched with highest priority.
2020-07-06LibCore: Only deliver Read/Write events to listening notifiersAndreas Kling
If a notifier has disabled read/write notifications via its event mask, we should not spam it with events, even if they have a hook callback.
2020-07-05LibCore: Stop select()'ing after an interrupt if a quit was requestedAnotherTest
This allows signal handlers to request the loop to terminate.
2020-06-13AK: JsonParser improvementsMatthew Olsson
- Parsing invalid JSON no longer asserts Instead of asserting when coming across malformed JSON, JsonParser::parse now returns an Optional<JsonValue>. - Disallow trailing commas in JSON objects and arrays - No longer parse 'undefined', as that is a purely JS thing - No longer allow non-whitespace after anything consumed by the initial parse() call. Examples of things that were valid and no longer are: - undefineddfz - {"foo": 1}abcd - [1,2,3]4 - JsonObject.for_each_member now iterates in original insertion order
2020-06-02LibCore: Put some annoying debug spam behind EVENTLOOP_DEBUGAndreas Kling
2020-05-29LibCore+Inspector: Move RPC sockets to /tmp/rpcSergey Bugaev
We have a hierarchical filesystem, let's make use of it :^)
2020-05-29LibCore: Do not assert that we can start the RPC serverSergey Bugaev
Now that the Shell uses Core::EventLoop, we can't afford to just crash if /tmp is unwritable.
2020-05-16LibCore: Always wait_for_events() when pumping the event loopAndreas Kling
This fixes an issue where continuously posting new events to the queue would keep the event loop saturated, causing it to ignore notifiers. Since notifiers are part of the big select(), we always have to call wait_for_events() even if there are pending events. We're already smart enough to select() without a timeout if we already have pending events.
2020-05-15LibCore: Fix timer expiration processingSergey Bugaev
The previous code did not account for the case when there are timers present, but none are enabled, and used a zero polling timeout. Fixes https://github.com/SerenityOS/serenity/issues/2222
2020-04-30LibCore: Do not assert that NonnullRefPtr is non-nullSergey Bugaev
Clang complains about this; with the change the next commit is going to make to ASSERT() internals, GCC is going to start to complain as well.
2020-04-03LibCore: Don't replay last handled event when leaving nested event loopAndreas Kling
The event that triggered the exit from an inner event loop would always get re-delivered in the outer event loop due to a silly off-by-one mistake when transferring pending events between loops.
2020-03-19LibCore: Use monotonic time when handling timersLiav A
2020-03-10EventLoop: Don't destroy ID allocator (#1403)Alex Muscar
The ID allocator is destroyed before a timer in HackStudio is is unregistered leading to an access violation. Fixes #1382.
2020-03-08AK: Add global FlatPtr typedef. It's u32 or u64, based on sizeof(void*)Andreas Kling
Use this instead of uintptr_t throughout the codebase. This makes it possible to pass a FlatPtr to something that has u32 and u64 overloads.
2020-03-05LibCore: Add a way to set an individual Core::Object property remotelyAndreas Kling
2020-03-05LibCore: Allow RPC clients to specify the currently inspected objectAndreas Kling
Add a SetInspectedObject call that tells us which Core::Object a remote client is currently looking it. Objects get notified when they gain their first inspector, and when they lose their last one.
2020-02-25AK: Make Vector use size_t for its size and capacityAndreas Kling
2020-02-20AK: Use size_t for ByteBuffer sizesAndreas Kling
This matches what we already do for string types.
2020-02-15LibCore: Reduce header dependencies of EventLoopAndreas Kling
2020-02-14LibCore: Add a forward declaration headerAndreas Kling
This patch adds <LibCore/Forward.h> and uses it in various places to shrink the header dependency graph.
2020-02-06LibCore: Merge the CSyscallUtils namespace into CoreAndreas Kling
2020-02-06LibCore: Remove leading C from filenamesAndreas Kling