Skip to content

Add Environment::availableProcessors()#350

Merged
thekid merged 7 commits intoxp-framework:mainfrom
thekid:feature/available-processors
Apr 12, 2025
Merged

Add Environment::availableProcessors()#350
thekid merged 7 commits intoxp-framework:mainfrom
thekid:feature/available-processors

Conversation

@thekid
Copy link
Copy Markdown
Member

@thekid thekid commented Apr 11, 2025

$nproc= Environment::availableProcessors();

Inspired by .NET: https://learn.microsoft.com/en-us/dotnet/api/system.environment.processorcount?view=net-10.0

Platforms

@thekid
Copy link
Copy Markdown
Member Author

thekid commented Apr 11, 2025

@thekid thekid changed the title Add Runtime::availableProcessors() Add Environment::availableProcessors() Apr 12, 2025
@thekid
Copy link
Copy Markdown
Member Author

thekid commented Apr 12, 2025

.NET has this in its Environment class: https://learn.microsoft.com/en-us/dotnet/api/system.environment.processorcount?view=net-10.0

Moved away from Runtime (as seen in Kotlin) to Environment, the latter is a better place - especially now that we take the Docker environment into account.

@thekid thekid merged commit e3932f6 into xp-framework:main Apr 12, 2025
13 checks passed
@thekid thekid deleted the feature/available-processors branch April 12, 2025 08:11
@thekid
Copy link
Copy Markdown
Member Author

thekid commented Apr 12, 2025

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant