Commit Graph

129 Commits

Author SHA1 Message Date
Robin Burchell
a9d1a86e6e CProcessStatisticsReader: Be consistent about terminology from the kernel down 2019-07-18 07:23:26 +02:00
Robin Burchell
9c8dd836fc Rename new IPC headers & classes
Sticking these in a namespace allows us to use a more generic
("Connection") term without clashing, which is way easier to understand
than to try to come up with unique names for both.
2019-07-17 20:16:44 +02:00
Robin Burchell
2177594c96 Port LibGUI to use CIPCClientSideConnection
As a consequence, move to use an explicit handshake() method rather than
calling virtuals from the constructor. This seemed to not bother
AClientConnection, but LibGUI crashes (rightfully) because of it.
2019-07-17 20:16:44 +02:00
Robin Burchell
41bece0682 Make AClientConnection generic 2019-07-17 20:16:44 +02:00
Robin Burchell
6eaa6826fa Port WSClientConnection to CIPCServerSideClient 2019-07-17 20:16:44 +02:00
Robin Burchell
edcbba9e98 Introduce CIPCServerSideClient
As a new base class of IPC connections server-side.
Port ASClientConnection to CIPCServerSideClient.
2019-07-17 20:16:44 +02:00
Robin Burchell
d8387f1506 CNotifier: Turn into a CObject and Use the event queue to deliver events
This way, CNotifier can mutate state to its little heart's content
without destroying the world when the global CNotifier hash changes
during delivery.
2019-07-16 20:47:32 +02:00
Robin Burchell
a714fc661d LibCore: Add a way to mark a socket as blocking (or not)
If custom I/O is being done outside CIODevice, we need a way to force blocking sometimes.
This also fixes the default of CLocalSocket to be non-blocking, the same
as CTCPSocket.
2019-07-16 20:22:54 +02:00
Robin Burchell
7bf420d83d CNotifier: Provide a way to unregister a notifier temporarily 2019-07-16 15:23:57 +02:00
Robin Burchell
e922db68d8 CSocket: Also call on_connected for local socket connections 2019-07-16 13:18:37 +02:00
Robin Burchell
14b2f90920 LibCore: Always call on_connected whether the connection was synchronous or not
It's unreasonable to expect the client to have to call it themselves if
the connection was immediate (local).
2019-07-16 13:18:37 +02:00
Robin Burchell
cd497accbe CLocalSocket: Add missing pragma once 2019-07-14 15:29:59 +02:00
Andreas Kling
e8d61bb8c0 CEventLoop: Oops, I had the pipe reader/writer fd's mixed up. 2019-07-14 14:28:24 +02:00
Andreas Kling
4c0c93ce09 LibCore: Oops, fix infinite recursion in LogStream << CSocketAddress. 2019-07-14 14:24:37 +02:00
Andreas Kling
c9ee481cdf LibCore: Port CSocket over to using dbg().
Also added a LogStream operator<< for CSocketAddress.
2019-07-14 11:02:40 +02:00
Andreas Kling
b4329a8eec CObject: Add LogStream operator<< for CObject. 2019-07-14 10:59:26 +02:00
Andreas Kling
a634fab3c4 CObject: Add custom_event() virtual.
This way you can just override custom_event() to catch CCustomEvent instead
of having to filter the entire event stream with event(). :^)
2019-07-14 10:27:27 +02:00
Andreas Kling
17ee548bcd CEventLoop: Add wake(), a mechanism for waking up when blocked in select().
This patch generalizes the concept used in Piano to wake up the event loop
so it can react to something happening on a secondary thread.
Basically, there's a pipe who is always part of the file descriptor set we
pass to select(), and calling wake() simply writes a little to that pipe.
2019-07-14 10:20:57 +02:00
Andreas Kling
f1d6a37d5d LibCore: Add CThread, a simple thread abstraction object.
Currently this is only a simple wrapper around create_thread() that
remembers the thread ID of the spawned thread.
2019-07-14 10:19:51 +02:00
Robin Burchell
ffa8cb668f AudioServer: Assorted infrastructure work
* Add a LibAudio, and move WAV file parsing there (via AWavFile and AWavLoader)
* Add CLocalSocket, and CSocket::connect() variant for local address types.
  We make some small use of this in WindowServer (as that's where we
  modelled it from), but don't get too invasive as this PR is already
  quite large, and the WS I/O is a bit carefully done
* Add an AClientConnection which will eventually be used to talk to
  AudioServer (and make use of it in Piano, though right now it really
  doesn't do anything except connect, using our new CLocalSocket...)
2019-07-13 22:57:24 +02:00
Andreas Kling
302cae5c2f CEventLoop: When asked to exit the event loop, exit right away.
Don't process any more events. We already prepend the remaining events in
this loop to the outer loop if needed.

If there were any more events queued after the exit request, the iteration
code would make an invalid access into 'queued_events'.

Fixes #300.
2019-07-13 19:54:57 +02:00
Andreas Kling
debc587ce2 LibCore: Add CCustomEvent, a custom CEvent for arbitrary use.
For convenience it includes an int, and a void*. Interpretation of the
contents is up to the client.
2019-07-13 18:35:13 +02:00
Andreas Kling
b06d2c04dc CObject: Add a "name" property.
This will be useful for things like the VisualBuilder code generator.
2019-07-10 20:33:53 +02:00
Andreas Kling
c33766f039 LibCore: Tweak slightly-off error message in CProcessStatisticsReader. 2019-07-10 15:32:30 +02:00
Andreas Kling
01216f3c3f Userland+LibCore: Use CProcessStatisticsReader to implement top.
Also tweaked CProcessStatisticsReader a bit to simplify the API.
2019-07-10 13:56:28 +02:00
Andreas Kling
0e75aba7c3 StringView: Rename characters() to characters_without_null_termination().
This should make you think twice before trying to use the const char* from
a StringView as if it's a null-terminated string.
2019-07-08 15:38:44 +02:00
Andreas Kling
56563cb305 CDirIterator: Fix another instance of StringView::characters() misuse. 2019-07-08 14:03:19 +02:00
Andreas Kling
8b0953a795 Libraries: Unbreak "make install" with new directory locations. 2019-07-04 16:41:42 +02:00
Andreas Kling
04b9dc2d30 Libraries: Create top level directory for libraries.
Things were getting a little crowded in the project root, so this patch
moves the Lib*/ directories into Libraries/.
2019-07-04 16:16:50 +02:00