Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.
/ corefx Public archive

Shim'ing out the processor affinity function calls for the Linux kernel #3798

Merged
merged 1 commit into from
Oct 13, 2015
Merged

Conversation

jonmill
Copy link

@jonmill jonmill commented Oct 13, 2015

Shim'ing out the processor affinity function calls for the Linux kernel

/cc @nguerrera @stephentoub

@nguerrera
Copy link
Contributor

LGTM

internal static unsafe extern void CpuSet(int cpu, CpuSetBits* set);

[DllImport(Libraries.SystemNative)]
internal static unsafe extern bool CpuIsSet(int cpu, CpuSetBits* set);
Copy link
Member

Choose a reason for hiding this comment

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

Can these functions use ref/out rather than pointers?

Copy link
Author

Choose a reason for hiding this comment

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

Sure

@stephentoub
Copy link
Member

A few comments/questions, but otherwise LGTM.

{
internal static partial class Sys
{
internal unsafe struct CpuSetBits
Copy link
Member

Choose a reason for hiding this comment

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

One more thought. Since the Bits field is never used and is here purely to impact the size of the struct, you could just add a StructLayout attribute to the type to set its size to 128. Then the type wouldn't need to be unsafe. But if you'd prefer to stick with what you have, that's fine, though you might chaynge the visibility of Bits to be private.

Copy link
Author

Choose a reason for hiding this comment

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

I'll change the field to be private so that it's still visible what the struct contains and how it fits with the native implementation.

Copy link
Member

Choose a reason for hiding this comment

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

Ok.

@stephentoub
Copy link
Member

LGTM

@jonmill
Copy link
Author

jonmill commented Oct 13, 2015

Everything is green with LGTM's....merging. Thanks folks!

jonmill pushed a commit that referenced this pull request Oct 13, 2015
Shim'ing out the processor affinity function calls for the Linux kernel
@jonmill jonmill merged commit 7691049 into dotnet:master Oct 13, 2015
@jonmill jonmill deleted the shim branch October 13, 2015 21:06
@karelz karelz modified the milestone: 1.0.0-rtm Dec 3, 2016
picenka21 pushed a commit to picenka21/runtime that referenced this pull request Feb 18, 2022
Shim'ing out the processor affinity function calls for the Linux kernel

Commit migrated from dotnet/corefx@7691049
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants