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

Value initialize pthread_t class members in constructor #812

Merged
merged 3 commits into from
Aug 16, 2021

Conversation

pudelkoM
Copy link
Member

@pudelkoM pudelkoM commented Aug 12, 2021

We should make sure all pthread_t class members are initialized, but pthread_t is a opaque value which can map to a struct, pointer, or numeric type. Therefore, the safest approach is value initialization and letting the compiler do the right thing.

POSIX.1 allows an implementation wide freedom in choosing the type used to represent a thread ID; for example,
representation using either an arithmetic type or a structure is permitted.

Example playground: https://cpp.godbolt.org/z/f63cf48hn

@pudelkoM pudelkoM requested a review from bocon13 August 12, 2021 22:20
@codecov
Copy link

codecov bot commented Aug 12, 2021

Codecov Report

Merging #812 (341778e) into main (9d9770f) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #812   +/-   ##
=======================================
  Coverage   78.61%   78.61%           
=======================================
  Files         334      334           
  Lines       30003    30006    +3     
=======================================
+ Hits        23587    23590    +3     
  Misses       6416     6416           
Impacted Files Coverage Δ
stratum/hal/lib/barefoot/bfrt_packetio_manager.cc 87.10% <100.00%> (ø)
stratum/hal/lib/bcm/bcm_packetio_manager.h 100.00% <100.00%> (ø)
stratum/hal/lib/common/hal.cc 78.18% <100.00%> (ø)
stratum/hal/lib/phal/attribute_database.h 100.00% <100.00%> (ø)
stratum/hal/lib/phal/onlp/onlp_event_handler.h 100.00% <100.00%> (ø)
stratum/hal/lib/phal/udev_event_handler.h 100.00% <100.00%> (ø)
stratum/lib/security/auth_policy_checker.cc 31.03% <100.00%> (ø)
stratum/procmon/procmon.cc 84.15% <100.00%> (ø)
stratum/hal/lib/phal/attribute_database.cc 59.47% <0.00%> (ø)

@pudelkoM pudelkoM merged commit 18d0efb into main Aug 16, 2021
@pudelkoM pudelkoM deleted the value-init-pthread_t branch August 16, 2021 23:30
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

1 participant