Skip to content

Commit

Permalink
fix epoll server fd leak in co mode
Browse files Browse the repository at this point in the history
  • Loading branch information
ruanshudong committed Oct 12, 2023
1 parent fca7031 commit 4167fc1
Show file tree
Hide file tree
Showing 3 changed files with 1,610 additions and 1,588 deletions.
11 changes: 8 additions & 3 deletions util/src/tc_coroutine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -326,16 +326,13 @@ TC_CoroutineScheduler::TC_CoroutineScheduler()
, _currentCoro(NULL)
, _all_coro(NULL)
{
// LOG_CONSOLE_DEBUG << endl;

_epoller = new TC_Epoller();

_epoller->create(10240);
}

TC_CoroutineScheduler::~TC_CoroutineScheduler()
{
// LOG_CONSOLE_DEBUG << endl;
if(_epoller)
{
delete _epoller;
Expand Down Expand Up @@ -666,6 +663,12 @@ void TC_CoroutineScheduler::terminate()
assert(_epoller);

_epoller->terminate();
//
// if(_epoller)
// {
// delete _epoller;
// _epoller = NULL;
// }
}

uint32_t TC_CoroutineScheduler::generateId()
Expand Down Expand Up @@ -816,6 +819,8 @@ void TC_Coroutine::run()
handleCoro();

destroy();

// TC_CoroutineScheduler::reset();
}

void TC_Coroutine::terminate()
Expand Down
Loading

0 comments on commit 4167fc1

Please sign in to comment.