Skip to content
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

Allow using library in CurrentThread runtime #1082

Merged

Conversation

sgrebnov
Copy link
Contributor

The block_in_place function requires a multi-threaded runtime and will crash when executed in CurrentThread mode, which is the default for unit tests. While unit tests can be configured to run in multi-threaded mode, this is sometimes not practical or may require a significantly more complex setup, especially when tests involve tracing collectors.

With this change, the dummy run is skipped in single-threaded environments, simplifying the setup for unit tests.

@sgrebnov sgrebnov changed the title Allow using library in CurrentThread mode Allow using library in CurrentThread runtime Jan 22, 2025
Copy link

Code Metrics Report
  ===============================================================================
 Language            Files        Lines         Code     Comments       Blanks
===============================================================================
 C Header                2           35           28            0            7
 Dockerfile              1           41           22           10            9
 JSON                   12          105          104            0            1
 Python                 69         2926         2534           77          315
 Shell                   1           58           22           18           18
 Plain Text              3         3723            0         2413         1310
 TOML                   18          627          556            2           69
 YAML                    2           21           19            2            0
-------------------------------------------------------------------------------
 Jupyter Notebooks       4            0            0            0            0
 |- Markdown             2           77           32           31           14
 |- Python               2          205          178            1           26
 (Total)                            282          210           32           40
-------------------------------------------------------------------------------
 Markdown               46         3802            0         2891          911
 |- BASH                 6          103          100            0            3
 |- JSON                 1           12           12            0            0
 |- Python               7          121          109            0           12
 |- Rust                15          512          433            0           79
 |- TOML                 2           75           63            0           12
 (Total)                           4625          717         2891         1017
-------------------------------------------------------------------------------
 Rust                  309        99535        89232         1924         8379
 |- Markdown           149         1688           25         1538          125
 (Total)                         101223        89257         3462         8504
===============================================================================
 Total                 467       110873        92517         7337        11019
===============================================================================
  

@sgrebnov sgrebnov force-pushed the sgrebnov/current-thread-support branch from 11b167c to 55ba70b Compare January 22, 2025 22:50
Copy link
Owner

@EricLBuehler EricLBuehler left a comment

Choose a reason for hiding this comment

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

Thank you, looks great.

@EricLBuehler EricLBuehler merged commit 502d982 into EricLBuehler:master Jan 22, 2025
12 checks passed
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.

2 participants