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

Don't use boost::intrusive_ptr for thread_id_type #3120

Merged
merged 1 commit into from Jan 23, 2018

Conversation

sithhell
Copy link
Member

This change gets rid of using boost::intrusive_ptr to refcount thread_data. The
lifetime of thread_data is perfectly managed by the scheduling policy. That is,
once a task terminates, it can be deleted/reused.

Any background context you want to provide?

refcounting requires atomic operations which may needlessly (in this case) slow down an application.

@sithhell sithhell added this to the 1.1.0 milestone Jan 22, 2018
@@ -34,11 +34,6 @@

namespace hpx { namespace threads
{
class HPX_EXPORT thread_data;
Copy link
Member

Choose a reason for hiding this comment

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

The HPX_EXPORT needs to go somewhere else, now, I think.

Copy link
Member Author

Choose a reason for hiding this comment

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

it's in thread_id_type.hpp now.

Copy link
Member

Choose a reason for hiding this comment

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

So do other files now.

Copy link
Member Author

Choose a reason for hiding this comment

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

You are saying that this PR should fix all includes to not rely on thread_id_type being implicitly defined by some other include?

Copy link
Member

Choose a reason for hiding this comment

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

Not necessarily. OTOH, we're trying to cleanup our header-include situation. So when introducing a new header file, perhaps it might make sense to introduce it properly... We could even add an inspect check enforcing this.

Copy link
Member Author

Choose a reason for hiding this comment

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

Currently, the header exposing everything was thread_data_fwd.hpp, which still holds. Depending on how fine-grained we want to resolve those headers...
I'd do this in a separate PR though to not conflate those more or less unrelated changes with the header fixups.

Copy link
Member

Choose a reason for hiding this comment

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

ok

@@ -176,7 +176,7 @@ namespace hpx { namespace actions
: arguments_(std::forward<Ts>(vs)...),
Copy link
Member

Choose a reason for hiding this comment

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

This file now needs to #include thread_id_type.hpp

{
constexpr thread_id_type()
: thrd_(nullptr) {}
constexpr thread_id_type(thread_data* thrd)
Copy link
Member

Choose a reason for hiding this comment

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

We should make this constructor explicit to avoid unexpected conversions (we already have an implicit operator thread_data*() below).

@hkaiser
Copy link
Member

hkaiser commented Jan 22, 2018

Please fix the Windows and the CircleCI builds, then we can go ahead and merge this.

@sithhell sithhell force-pushed the thread_data_refcount branch 3 times, most recently from 3f3143e to e0c1b07 Compare January 23, 2018 11:04
This change gets rid of using boost::intrusive_ptr to refcount thread_data. The
lifetime of thread_data is perfectly managed by the scheduling policy. That is,
once a task terminates, it can be deleted/reused.
@sithhell
Copy link
Member Author

The build errors should be fixed now.

Copy link
Member

@hkaiser hkaiser left a comment

Choose a reason for hiding this comment

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

LGTM.

@hkaiser hkaiser merged commit 24ee1d0 into master Jan 23, 2018
@hkaiser hkaiser deleted the thread_data_refcount branch January 23, 2018 15:18
sithhell pushed a commit that referenced this pull request Jan 23, 2018
This change was neceessary after #3120 was merged. It was working with clang 5 and
gcc 6 and up for some reason.
sithhell pushed a commit that referenced this pull request Jan 23, 2018
This change was neceessary after #3120 was merged. It was working with clang 5 and
gcc 6 and up for some reason.
sithhell pushed a commit that referenced this pull request Jan 23, 2018
This change was neceessary after #3120 was merged. It was working with clang 5 and
gcc 6 and up for some reason.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants