| 523 | } |
| 524 | |
| 525 | int KqueuerObj::KqueueCtlDel(void* args) |
| 526 | { |
| 527 | MtFrame* frame = MtFrame::Instance(); |
| 528 | KqFdRef* fd_ref = (KqFdRef*)args; |
| 529 | kqueue_assert(fd_ref != NULL); |
| 530 | |
| 531 | int osfd = this->GetOsfd(); |
| 532 | int events = this->GetEvents(); |
| 533 | |
| 534 | KqueuerObj* old_obj = fd_ref->GetNotifyObj(); |
| 535 | if (old_obj != this) |
| 536 | { |
| 537 | MTLOG_ERROR("kqfd ref conflict, fd: %d, old: %p, now: %p", osfd, old_obj, this); |
| 538 | return -1; |
| 539 | } |
| 540 | fd_ref->SetNotifyObj(NULL); |
| 541 | |
| 542 | if (!frame->KqueueCtrlDelRef(osfd, events, false)) |
| 543 | { |
| 544 | MTLOG_ERROR("kqfd ref del failed, log"); |
| 545 | fd_ref->SetNotifyObj(old_obj); |
| 546 | return -2; |
| 547 | } |
| 548 | |
| 549 | return 0; |
| 550 | |
| 551 | } |
| 552 |
no test coverage detected