mirror of
https://github.com/justinian/jsix.git
synced 2025-12-10 00:14:32 -08:00
First pass at message syscalls
This commit is contained in:
@@ -25,7 +25,9 @@ enum class process_wait : uint8_t
|
||||
none,
|
||||
signal,
|
||||
child,
|
||||
time
|
||||
time,
|
||||
send,
|
||||
receive
|
||||
};
|
||||
|
||||
/// A process
|
||||
@@ -52,15 +54,30 @@ struct process
|
||||
|
||||
/// Unready this process until it gets a signal
|
||||
/// \arg sigmask A bitfield of signals to wake on
|
||||
void wait_on_signal(uint64_t sigmask);
|
||||
/// \returns Whether the process should be rescheduled
|
||||
bool wait_on_signal(uint64_t sigmask);
|
||||
|
||||
/// Unready this process until a child exits
|
||||
/// \arg pid PID of the child to wait for, or 0 for any
|
||||
void wait_on_child(uint32_t pid);
|
||||
/// \returns Whether the process should be rescheduled
|
||||
bool wait_on_child(uint32_t pid);
|
||||
|
||||
/// Unready this process until after the given time
|
||||
/// \arg time The time after which to wake
|
||||
void wait_on_time(uint64_t time);
|
||||
/// \returns Whether the process should be rescheduled
|
||||
bool wait_on_time(uint64_t time);
|
||||
|
||||
/// Try to send to the target process, becoming unready if it
|
||||
/// is not waiting on receive.
|
||||
/// \arg target_id The process to send to
|
||||
/// \returns Whether the process should be rescheduled
|
||||
bool wait_on_send(uint32_t target_id);
|
||||
|
||||
/// Try to receive from one or more processes, becoming unready
|
||||
/// if none of them are waiting on a send to this process.
|
||||
/// \arg source_id The process to receive from
|
||||
/// \returns Whether the process should be rescheduled
|
||||
bool wait_on_receive(uint32_t source_id);
|
||||
|
||||
/// If this process is waiting on the given signal, wake it
|
||||
/// \argument signal The signal sent to the process
|
||||
@@ -76,6 +93,17 @@ struct process
|
||||
/// \argument now The current time
|
||||
/// \returns True if this wake was handled
|
||||
bool wake_on_time(uint64_t now);
|
||||
|
||||
/// If this process is waiting to send to this target, wake it
|
||||
/// \argument target The target process
|
||||
/// \returns True if this wake was handled
|
||||
bool wake_on_send(process *target);
|
||||
|
||||
/// If this process is waiting to receieve from this source, wake it
|
||||
/// \argument source The process that is sending
|
||||
/// \returns True if this wake was handled
|
||||
bool wake_on_receive(process *source);
|
||||
|
||||
};
|
||||
|
||||
using process_list = kutil::linked_list<process>;
|
||||
|
||||
Reference in New Issue
Block a user