orbis-kernel: umtx: implement notify_n

This commit is contained in:
DH 2024-10-31 14:19:22 +03:00
parent cc0e81e88f
commit 2723eb0bfd
2 changed files with 40 additions and 34 deletions

View file

@ -36,13 +36,16 @@ struct UmtxCond {
struct UmtxChain {
utils::shared_mutex mtx;
utils::kmultimap<UmtxKey, UmtxCond> sleep_queue;
utils::kmultimap<UmtxKey, UmtxCond> spare_queue;
using queue_type = utils::kmultimap<UmtxKey, UmtxCond>;
queue_type sleep_queue;
queue_type spare_queue;
std::pair<const UmtxKey, UmtxCond> *enqueue(UmtxKey &key, Thread *thr);
void erase(std::pair<const UmtxKey, UmtxCond> *obj);
queue_type::iterator erase(queue_type::iterator it);
uint notify_one(const UmtxKey &key);
uint notify_all(const UmtxKey &key);
uint notify_n(const UmtxKey &key, sint count);
};
class alignas(__STDCPP_DEFAULT_NEW_ALIGNMENT__) KernelContext final {