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 for new map-like functions #296

Merged
merged 2 commits into from
Feb 8, 2024
Merged

Conversation

MarcMush
Copy link
Collaborator

@MarcMush MarcMush commented Jan 31, 2024

the @showprogress macro doesn't check anymore if functions are in a predefined list of allowed functions, instead, ncalls should be defined for the used function. This allows to add new map-like function, for example tmap:

using ThreadTools, ProgressMeter

ProgressMeter.ncalls(::typeof(tmap), ::Function, args...) = ProgressMeter.ncalls_map(args...)
ProgressMeter.ncalls(::typeof(tmap), ::Function, ::Int, args...) = ProgressMeter.ncalls_map(args...)

@showprogress tmap(abs2, 1:10^5)
@showprogress tmap(abs2, 4, 1:10^5)

fix #144, fix #251

Copy link

codecov bot commented Jan 31, 2024

Codecov Report

Attention: 2 lines in your changes are missing coverage. Please review.

Comparison is base (65d049e) 96.81% compared to head (6a339e0) 96.79%.
Report is 3 commits behind head on master.

Files Patch % Lines
src/ProgressMeter.jl 93.10% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #296      +/-   ##
==========================================
- Coverage   96.81%   96.79%   -0.02%     
==========================================
  Files           1        1              
  Lines         533      530       -3     
==========================================
- Hits          516      513       -3     
  Misses         17       17              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@MarcMush MarcMush merged commit befd9f8 into timholy:master Feb 8, 2024
11 of 14 checks passed
@MarcMush MarcMush mentioned this pull request Mar 4, 2024
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.

ThreadsX.map support Support for threadtools https://github.com/baggepinnen/ThreadTools.jl
1 participant