Skip to content

Commit

Permalink
Formatting, fix VC build
Browse files Browse the repository at this point in the history
  • Loading branch information
khizmax committed Aug 8, 2020
1 parent a42cdf3 commit 4e2d654
Show file tree
Hide file tree
Showing 8 changed files with 1,072 additions and 1,041 deletions.
521 changes: 266 additions & 255 deletions cds/gc/details/hp_common.h

Large diffs are not rendered by default.

1,509 changes: 762 additions & 747 deletions cds/gc/hp.h

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions cds/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@

// cds library version

#define CDS_VERSION 0x020303
#define CDS_VERSION 0x030000

#define CDS_VERSION_MAJOR ((CDS_VERSION & 0xFF0000)>> 16)
#define CDS_VERSION_MINOR ((CDS_VERSION & 0x00FF00) >> 8)
#define CDS_VERSION_PATCH (CDS_VERSION & 0x0000FF)

// CDS_VERSION == CDS_VERSION_MAJOR '.' CDS_VERSION_MINOR '.' CDS_VERSION_PATCH
#define CDS_VERSION_STRING "2.3.3"
#define CDS_VERSION_STRING "3.0.0"

#endif // #ifndef CDSLIB_VERSION_H

7 changes: 4 additions & 3 deletions change.log
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
2.3.4
Maintenance release
- added support for GCC-9, Clang-8, Clang-9 (fixed warnings)
3.0.0
General release
- Adapt libcds for HPX (https://github.com/STEllAR-GROUP/hpx), developed by Alexander Gaev (https://github.com/Krock21rus)
- added support for GCC-10, GCC-9, Clang-8, Clang-9 (fixed warnings)

2.3.3 31.12.2018
Maintenance release
Expand Down
1 change: 1 addition & 0 deletions projects/Win/vc141/cds.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1004,6 +1004,7 @@
<ClCompile Include="..\..\..\src\dhp.cpp" />
<ClCompile Include="..\..\..\src\dllmain.cpp" />
<ClCompile Include="..\..\..\src\hp.cpp" />
<ClCompile Include="..\..\..\src\hp_thread_local.cpp" />
<ClCompile Include="..\..\..\src\init.cpp" />
<ClCompile Include="..\..\..\src\thread_data.cpp" />
<ClCompile Include="..\..\..\src\topology_hpux.cpp" />
Expand Down
3 changes: 3 additions & 0 deletions projects/Win/vc141/cds.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,9 @@
<ClCompile Include="..\..\..\src\dhp.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\hp_thread_local.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\..\cds\init.h">
Expand Down
67 changes: 33 additions & 34 deletions src/hp_thread_local.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,39 +6,38 @@
#include <cds/gc/hp.h>
#include <map>

namespace cds {
namespace gc {
namespace hp {
namespace details {
thread_local thread_data *tls_ = nullptr;
thread_local std::pair<thread_data *, thread_data *> *tls2_ = new std::pair<thread_data *, thread_data *>(
nullptr,
nullptr);

/*static*/ CDS_EXPORT_API thread_data *DefaultTLSManager::getTLS() {
return tls_;
}

/*static*/ CDS_EXPORT_API void DefaultTLSManager::setTLS(thread_data *new_tls) {
tls_ = new_tls;
}

/*static*/ CDS_EXPORT_API thread_data *StrangeTLSManager::getTLS() {
if (cds::OS::get_current_thread_id() % 2 == 0) { // % 2 with ThreadId structure?
return tls2_->second;
} else {
return tls2_->first;
}
}

/*static*/ CDS_EXPORT_API void StrangeTLSManager::setTLS(thread_data *new_tls) {
if (cds::OS::get_current_thread_id() % 2 == 0) { // % 2 with ThreadId structure?
tls2_->second = new_tls;
} else {
tls2_->first = new_tls;
}
}
}
namespace cds { namespace gc { namespace hp { namespace details {

// for DefaultTLS Manager
thread_local thread_data *tls_ = nullptr;

// for StrangeTLSManager
thread_local std::pair<thread_data *, thread_data *> *tls2_ = new std::pair<thread_data *, thread_data *>(
nullptr,
nullptr);

/*static*/ CDS_EXPORT_API thread_data *DefaultTLSManager::getTLS() {
return tls_;
}

/*static*/ CDS_EXPORT_API void DefaultTLSManager::setTLS(thread_data *new_tls) {
tls_ = new_tls;
}

/*static*/ CDS_EXPORT_API thread_data *StrangeTLSManager::getTLS() {
if (cds::OS::get_current_thread_id() % 2 == 0) { // % 2 with ThreadId structure?
return tls2_->second;
} else {
return tls2_->first;
}
}
}

/*static*/ CDS_EXPORT_API void StrangeTLSManager::setTLS(thread_data *new_tls) {
if (cds::OS::get_current_thread_id() % 2 == 0) { // % 2 with ThreadId structure?
tls2_->second = new_tls;
} else {
tls2_->first = new_tls;
}
}

}}}} // namespace cds::gc::hp::details
1 change: 1 addition & 0 deletions thanks
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
Many thanks to the contributors who feedbacks the errors and propositions for libcds.
In alphabetical order:

Alexander Gaev (https://github.com/Krock21rus)
Amila Jayasekara
Arvid Gerstmann (https://github.com/Leandros)
blinkenlichten (https://github.com/blinkenlichten)
Expand Down

0 comments on commit 4e2d654

Please sign in to comment.