Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: use RAII to release resources in async task #1502

Merged
merged 3 commits into from
May 16, 2023

Conversation

A2ureStone
Copy link
Contributor

No description provided.

@wanghenshui wanghenshui changed the title use raii to release resources in async task fix: use raii to release resources in async task May 15, 2023
@AlexStocks AlexStocks changed the title fix: use raii to release resources in async task fix: use RAII to release resources in async task May 15, 2023
@AlexStocks
Copy link
Collaborator

image

如果 arg 是 new 出来的,这么改动,能保证 arg 会被释放掉么?

@A2ureStone
Copy link
Contributor Author

可以的, unique_ptr接受一个指针, 在析构的时候调用对应参数类型的delete函数

src/pika_client_conn.cc Outdated Show resolved Hide resolved
@loveyacper
Copy link
Collaborator

loveyacper commented May 16, 2023

传递void*指针,基本是编码设计上的缺陷,本次修改治标。若治本,未来要解决掉 void*

@AlexStocks AlexStocks merged commit 979d16d into OpenAtomFoundation:unstable May 16, 2023
7 checks passed
bigdaronlee163 pushed a commit to bigdaronlee163/pika that referenced this pull request Jun 8, 2024
…1502)

* use raii to release resources in async task

* use static_cast instead of reinterpret_cast

---------

Co-authored-by: J1senn <J1senn@outlook.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants