Skip to content

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

Open
grindaah wants to merge 1 commit intocrystax:masterfrom
grindaah:patch-1
Open

cpu_set should be constant by logic and by other distributions#1
grindaah wants to merge 1 commit intocrystax:masterfrom
grindaah:patch-1

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