Skip to content

Conversation

@kallewoof
Copy link
Contributor

Continuation of #9387. I believe this concludes fixing the // XXX RAII places.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why the manual release?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because eventBase/eventHTTP are global and need them intact. If I don't release they'd be deleted on function return.

Copy link
Contributor

@dcousens dcousens Jan 11, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean, I guess it improves consistency, and the .release(), if you added a comment noting the above about the lifetime, might be clearer than what was there before?

This change seems pointless IMHO, maybe I'm missing something

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, you're right. Addressing.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Regarding purpose: the one thing this brings is that no matter how things end, the base and http objects will be properly cleaned up. I have no idea what kind of side-effects an initialized and forgotten event base or evhttp might have. Perhaps none whatsoever.

Copy link
Contributor

@dcousens dcousens Jan 11, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the case of event_base, the wrapper does the error handling already.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about

eventBase = base_ctr.release();
eventHTTP = http_ctr.release();

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That looks much better. I didn't realize you could do that. Thanks!

@kallewoof
Copy link
Contributor Author

Rebased.

@jtimon
Copy link
Contributor

jtimon commented Mar 23, 2017

Fast review ACK

Copy link
Contributor

@gmaxwell gmaxwell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK (mostly tested ACK, I'm not so useful for reviewing this stuff. :) )

@laanwj
Copy link
Member

laanwj commented Jun 22, 2017

utACK 1ae86ec

@laanwj laanwj merged commit 1ae86ec into bitcoin:master Jun 22, 2017
laanwj added a commit that referenced this pull request Jun 22, 2017
…ibevents.

1ae86ec Changed event RAII helper functions to inline to deal with duplicate symbol linker errors. (Karl-Johan Alm)
fd369d2 Switched httpserver.cpp to use RAII wrapped libevents. (Kalle Alm)

Tree-SHA512: 877e431f211024d42a3b0800e860e02833398611433e8393f8d5d4970f47f4bd670b900443678c067fec110c087aaab7dc1981ccbf17f6057676fdbbda89aed9
@kallewoof kallewoof deleted the raii-httpserver branch June 23, 2017 00:38
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jul 11, 2019
…apped libevents.

1ae86ec Changed event RAII helper functions to inline to deal with duplicate symbol linker errors. (Karl-Johan Alm)
fd369d2 Switched httpserver.cpp to use RAII wrapped libevents. (Kalle Alm)

Tree-SHA512: 877e431f211024d42a3b0800e860e02833398611433e8393f8d5d4970f47f4bd670b900443678c067fec110c087aaab7dc1981ccbf17f6057676fdbbda89aed9
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Sep 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants