port-request-notifications.lisp 1.2 KB

1234567891011121314151617181920212223242526272829
  1. (defcfun ("mach_port_request_notification" %mach-port-request-notification!)
  2. err
  3. (task ipc-space)
  4. (name port)
  5. (variant msg-notify)
  6. (sync port-mscount)
  7. (notify port)
  8. (notify-type msg-type-name)
  9. (previous #:pointer))
  10. (defun port-request-notification! (port variant sync notify notify-type
  11. &optional (task (task-self)))
  12. "Registers a request for a notification and supplies the send-once right notify to which the notification will be sent."
  13. (with-foreign-object (foo 'port)
  14. (let ((error-code (%mach-port-request-notification! task
  15. port
  16. variant
  17. sync
  18. notify
  19. notify-type
  20. foo)))
  21. (select-error error-code
  22. (let ((foo-ref (mem-ref foo 'port)))
  23. (when (port-valid? foo-ref)
  24. (port-deallocate! foo-ref task)
  25. t))))))