[問題] 關於cocoa 的notification
我在寫一個 跟usb device 有關的 cocoa application
參考 /Developer/Examples/IOKit/usb/USBNotification Example
用這個function: IOServiceAddMatchingNotification
我利用CFRunloop 和 Notification 去抓USB device被拔掉的event
然後會去呼叫一個 callback function 做一些 clean
拔掉的時間點 是完全不一定的 有可能跑到一半 就被拔掉
實做完之後卻發現 如果正跑到一半
這個notification 的 callback function 不會在拔掉event發生的第一時間去呼叫
而是跑完之後才call
我在想我是不是用錯東西了 我想要的是再拔掉的那瞬間 就進入我註冊的callback
不知道有沒有大大能夠給我一點線索...感恩
--
◢███◣ ███ ◢███◣ ███ ◢██◣
█ █ █ █ █ █ █ █ █ ◤
█ █ █ ███ █ █ █ ███ ◥██◤
◢◤◢◤◢◤◢██◤◢◤◢◤◢◤◢██◤ ◢██◣
◢◤◢◤◢◤ ◢◤ ◢◤◢◤◢◤ ◢◤ ◢◤ ◤
◥███◤◢██◤ ◥███◤◢██◤ ◥██◤
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 61.228.108.31
討論串 (同標題文章)
以下文章回應了本文 (最舊先):
完整討論串 (本文為第 1 之 3 篇):