SysCallbacks.h 848 B

12345678910111213141516171819202122232425262728293031
  1. #pragma once
  2. #include "syscb/api_syscb.h"
  3. #include <vector>
  4. #include "nu/AutoLock.h"
  5. #include "service/types.h"
  6. #include "nx/nxstring.h"
  7. #include "nswasabi/ServiceName.h"
  8. class SysCallbacks : public api_syscb
  9. {
  10. public:
  11. WASABI_SERVICE_NAME("System Callbacks API");
  12. public:
  13. SysCallbacks();
  14. int WASABICALL SysCallbacks_RegisterCallback(ifc_sysCallback *cb);
  15. int WASABICALL SysCallbacks_UnregisterCallback(ifc_sysCallback *cb);
  16. int WASABICALL SysCallbacks_IssueCallback(GUID eventtype, int msg, intptr_t param1 = 0, intptr_t param2 = 0);
  17. ifc_sysCallback *WASABICALL SysCallbacks_Enum(GUID eventtype, size_t n);
  18. private:
  19. nu::LockGuard callbackGuard;
  20. std::vector<ifc_sysCallback*> callbacks;
  21. std::vector<ifc_sysCallback*> deleteMeAfterCallbacks;
  22. bool inCallback;
  23. volatile int reentry;
  24. };
  25. extern SysCallbacks system_callbacks;