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

Legal problem with win32/thread_primitives.hpp #209

Closed
pdimov opened this issue Feb 20, 2018 · 4 comments · Fixed by #211
Closed

Legal problem with win32/thread_primitives.hpp #209

pdimov opened this issue Feb 20, 2018 · 4 comments · Fixed by #211

Comments

@pdimov
Copy link
Member

pdimov commented Feb 20, 2018

A third-party legal review has identified a problem as reported here:

https://lists.boost.org/Archives/boost/2018/02/241435.php

regarding

// Borrowed from https://stackoverflow.com/questions/8211820/userland-interrupt-timer-access-such-as-via-kequeryinterrupttime-or-similar
inline ticks_type __stdcall GetTickCount64emulation()
{
static long count = -1l;
unsigned long previous_count, current_tick32, previous_count_zone, current_tick32_zone;
ticks_type current_tick64;
previous_count = (unsigned long) boost::detail::interlocked_read_acquire(&count);
current_tick32 = ::boost::winapi::GetTickCount();
if(previous_count == (unsigned long)-1l)
{
// count has never been written
unsigned long initial_count;
initial_count = current_tick32 >> 28;
previous_count = (unsigned long) _InterlockedCompareExchange(&count, (long)initial_count, -1l);
current_tick64 = initial_count;
current_tick64 <<= 28;
current_tick64 += current_tick32 & 0x0FFFFFFF;
return current_tick64;
}

introduced by

04c5341

The easiest way to fix that is to rewrite GetTickCount64emulation in terms of boost::atomic_uint64_t. As pointed out in

https://lists.boost.org/Archives/boost/2018/02/241453.php

an implementation already exists in Boost.Log:

https://github.com/boostorg/log/blob/1cc577cbf5fae8f55c71c4493a7ef89027bd85dc/src/timestamp.cpp#L66-L86

@viboes
Copy link
Collaborator

viboes commented Feb 20, 2018

I missed the comment on this commit.

could someone provide a PR?

@viboes viboes added the license label Feb 20, 2018
@pdimov
Copy link
Member Author

pdimov commented Feb 20, 2018

@Lastique perhaps?

@Lastique
Copy link
Member

I will make a PR shortly.

@viboes
Copy link
Collaborator

viboes commented Feb 20, 2018

Thank you very much.

Lastique added a commit to Lastique/thread that referenced this issue Feb 20, 2018
This is to resolve the possible license violation as the previous
implementation has been taken from StackOverflow and was not licensed
under the Boost Software License. The new implementation was adopted from
Boost.Log:

https://github.com/boostorg/log/blob/1cc577cbf5fae8f55c71c4493a7ef89027bd85dc/src/timestamp.cpp#L66-L86

The legal issue has been raised in:

https://lists.boost.org/Archives/boost/2018/02/241453.php

Fixes boostorg#209.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants