Various fiddlings.

This commit is contained in:
Ben Vanik
2014-06-22 19:41:26 -07:00
parent a5448b1296
commit 71eb408d67
9 changed files with 77 additions and 8 deletions

View File

@@ -20,6 +20,7 @@ XNotifyListener::XNotifyListener(KernelState* kernel_state) :
}
XNotifyListener::~XNotifyListener() {
kernel_state_->UnregisterNotifyListener(this);
xe_mutex_free(lock_);
if (wait_handle_) {
CloseHandle(wait_handle_);
@@ -32,9 +33,16 @@ void XNotifyListener::Initialize(uint64_t mask) {
lock_ = xe_mutex_alloc();
wait_handle_ = CreateEvent(NULL, TRUE, FALSE, NULL);
mask_ = mask;
kernel_state_->RegisterNotifyListener(this);
}
void XNotifyListener::EnqueueNotification(XNotificationID id, uint32_t data) {
// Ignore if the notification doesn't match our mask.
if ((mask_ & uint64_t(1 << ((id >> 25) + 1))) == 0) {
return;
}
xe_mutex_lock(lock_);
auto existing = notifications_.find(id);
if (existing != notifications_.end()) {

View File

@@ -21,9 +21,6 @@
namespace xe {
namespace kernel {
// Values seem to be all over the place - GUIDs?
typedef uint32_t XNotificationID;
class XNotifyListener : public XObject {
public: