MCPcopy Create free account
hub / github.com/F-Stack/f-stack / KqueueCtlAdd

Method KqueueCtlAdd

adapter/micro_thread/kqueue_proxy.cpp:497–523  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

495}
496
497int KqueuerObj::KqueueCtlAdd(void* args)
498{
499 MtFrame* frame = MtFrame::Instance();
500 KqFdRef* fd_ref = (KqFdRef*)args;
501 kqueue_assert(fd_ref != NULL);
502
503 int osfd = this->GetOsfd();
504 int new_events = this->GetEvents();
505
506 // Notify object needs updating
507 KqueuerObj* old_obj = fd_ref->GetNotifyObj();
508 if ((old_obj != NULL) && (old_obj != this))
509 {
510 MTLOG_ERROR("kqfd ref conflict, fd: %d, old: %p, now: %p", osfd, old_obj, this);
511 return -1;
512 }
513 fd_ref->SetNotifyObj(this);
514
515 if (!frame->KqueueCtrlAdd(osfd, new_events))
516 {
517 MTLOG_ERROR("kqfd ref add failed, log");
518 fd_ref->SetNotifyObj(old_obj);
519 return -2;
520 }
521
522 return 0;
523}
524
525int KqueuerObj::KqueueCtlDel(void* args)
526{

Callers 1

KqueueAddObjMethod · 0.45

Calls 5

GetOsfdMethod · 0.95
GetEventsMethod · 0.95
GetNotifyObjMethod · 0.80
SetNotifyObjMethod · 0.80
KqueueCtrlAddMethod · 0.80

Tested by

no test coverage detected