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

Draft: Add compat atomic header from dav1d #1944

Closed
wants to merge 1 commit into from

Conversation

quink-black
Copy link
Contributor

Fix #1920

Copy link
Collaborator

@maxsharabayko maxsharabayko left a comment

Choose a reason for hiding this comment

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

Wow, @quink-black, that is super helpful!
This PR provides three possible sources of atomic:

There are other possible compilers like IBM, Intel, etc. We don't have to cover every, but it might be worth having some fallback implementation with mutex lock and unlock. And a compilation warning to better enable C++11 for those compilers.
Or just demand to use C++11 when compilers other than gcc, MSVC or clang are used.
Something to decide on.

Comment on lines +30 to +35
#if defined(_MSC_VER)

#pragma warning(push)
#pragma warning(disable:4067) /* newline for __has_include_next */

#if defined(__clang__) && __has_include_next(<stdatomic.h>)
Copy link
Collaborator

Choose a reason for hiding this comment

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

clang in msvc... 🤔
I wonder what is the use case when both are defined?
Maybe clang targeting Window 10 (CLang MSVC compatibility). But not sure if _MSC_VER will be defined.

Comment on lines +11 to +13
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Worth checking what do we have to do.
Would we need to put "Copyright © 2018, VideoLAN" somewhere else, e.g. in our LICENCE.

@maxsharabayko maxsharabayko modified the milestones: v1.5.0, v1.4.4 Apr 15, 2021
@maxsharabayko maxsharabayko added [core] Area: Changes in SRT library core Type: Enhancement Indicates new feature requests labels Apr 15, 2021
@ethouris
Copy link
Collaborator

There is already a PR that includes atomic support and it's one of those submitted for fixing thread sanitizer reported problems.

@maxsharabayko
Copy link
Collaborator

@ethouris It would be helpful if you could share a link to the PR you mention.

@ethouris
Copy link
Collaborator

#1863 is the exact PR for atomic, but it would be good if you review everything that is submitted for Epic #1813.

@quink-black
Copy link
Contributor Author

#1863 is the exact PR for atomic, but it would be good if you review everything that is submitted for Epic #1813.

Good to know that.

dav1d use BSD license, simple google search shows that it's compatible with MPL, but I'm not sure. I have found the same project as in #1863 says:
https://github.com/mbitsnbites/atomic
It doesn't get update since 2017. dav1d is in active develop but it may have different compiler requirements than libsrt. My patch is incomplete since it doesn't take counting of the namespace issue (std::atomic_int vs ::atomic_int).

Feel free to close the PR. I'd like to get more ideas.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[core] Area: Changes in SRT library core Type: Enhancement Indicates new feature requests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Basic atomic operation support
3 participants