1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 10:27:35 +00:00

SystemServer: Add Service::try_create to propagate errors

This static method is used to propagate errors at the creation of the
object.
This commit is contained in:
Lucas CHOLLET 2022-06-08 18:29:08 +02:00 committed by Andreas Kling
parent dd3b65c762
commit 23fa6b1f7b
3 changed files with 25 additions and 20 deletions

View file

@ -14,9 +14,11 @@
#include <LibCore/Object.h>
class Service final : public Core::Object {
C_OBJECT(Service)
C_OBJECT_ABSTRACT(Service)
public:
static ErrorOr<NonnullRefPtr<Service>> try_create(Core::ConfigFile const& config, StringView name);
bool is_enabled() const;
void activate();
void did_exit(int exit_code);
@ -83,8 +85,8 @@ private:
// times where it has exited unsuccessfully and too quickly.
int m_restart_attempts { 0 };
void setup_socket(SocketDescriptor&);
void setup_sockets();
ErrorOr<void> setup_socket(SocketDescriptor&);
ErrorOr<void> setup_sockets();
void setup_notifier();
void handle_socket_connection();
};