Skip to content

cpu_set should be constant by logic and by other distributions #1

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

grindaah
Copy link

As I beleive __sched_cpucount should come with const-qualifier , because it doesn't change it.
This brakes builds that holds cpu_count mask in a class and trying to use CPU_COUNT macro inside the constant method

class Dummy
{
private:
cpu_set_t mask;
public:
int get_cpu_count () const
{
return CPU_COUNT(&mask);
}
};

PS. sorry if I am proposing some stupid thing, but I checked, that it is like that in couple of modern linux distributions.

As I beleive __sched_cpucount  should come with const, because it doesn't change it.
This brokes build that holds cpu_count mask in a class and trying to use CPU_COUNT macro inside the constant method

class Dummy
{
private:
     cpu_set_t mask;
public:
    int get_cpu_count () const
    {
        return CPU_COUNT(&_mask);
    }
};

PS sorry if I am proposing some stupid thing, but i checked, that it is like that in couple of modern linux distributions.
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.

1 participant