Skip to content

Adjusted test_lightweight to avoid zero threads in test.#2033

Open
petterreinholdtsen wants to merge 1 commit intouxlfoundation:masterfrom
petterreinholdtsen:hardware-single-core
Open

Adjusted test_lightweight to avoid zero threads in test.#2033
petterreinholdtsen wants to merge 1 commit intouxlfoundation:masterfrom
petterreinholdtsen:hardware-single-core

Conversation

@petterreinholdtsen
Copy link
Copy Markdown
Contributor

Description

When the hardware only support one core, hardware_concurrency() return 1, which when deviced by 2 using integer division end up as 0, a useless number of threads. Instead, ensure it end up as 1, while the other return values still end up with a sensible number by changing (i/2) to ((i+1)/2).

This fix is related to #2027.

Type of change

Choose one or multiple, leave empty if none of the other choices apply

Add a respective label(s) to PR if you have permissions

  • bug fix - change that fixes an issue
  • new feature - change that adds functionality
  • tests - change in tests
  • infrastructure - change in infrastructure and CI
  • documentation - documentation update

Tests

  • added - required for new features and some bug fixes
  • not needed

Documentation

  • updated in # - add PR number
  • needs to be updated
  • not needed

Breaks backward compatibility

  • Yes
  • No
  • Unknown

@dnmokhov dnmokhov requested a review from kboyarinov March 31, 2026 19:10
When the hardware only support one core, hardware_concurrency() return 1,
which when deviced by 2 using integer division end up as 0, a useless
number of threads.  Instead, ensure it end up as 1, while the other
return values still end up with a sensible number by changing
(i/2) to ((i+1)/2).

This fix is related to uxlfoundation#2027.
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