Skip to content

Commit

Permalink
make using ... explicit in docstrings
Browse files Browse the repository at this point in the history
  • Loading branch information
carstenbauer committed Mar 18, 2024
1 parent dd4b8e6 commit aeef73e
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 2 deletions.
12 changes: 12 additions & 0 deletions src/functions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ will get undefined results.
## Example:
```
using OhMyThreads: tmapreduce
tmapreduce(√, +, [1, 2, 3, 4, 5])
```
Expand Down Expand Up @@ -60,6 +62,8 @@ will get undefined results.
## Example:
```
using OhMyThreads: treducemap
treducemap(+, √, [1, 2, 3, 4, 5])
```
Expand Down Expand Up @@ -102,6 +106,8 @@ will get undefined results.
## Example:
```
using OhMyThreads: treduce
treduce(+, [1, 2, 3, 4, 5])
```
Expand Down Expand Up @@ -143,6 +149,8 @@ end
## Example:
```
using OhMyThreads: tforeach
tforeach(1:10) do i
println(i^2)
end
Expand Down Expand Up @@ -178,6 +186,8 @@ returned container, and will generally incur fewer allocations than the version
## Example:
```
using OhMyThreads: tmap
tmap(sin, 1:10)
```
Expand Down Expand Up @@ -227,6 +237,8 @@ returned container, and will generally incur fewer allocations than the version
## Example:
```
using OhMyThreads: tcollect
tcollect(sin(i) for i in 1:10)
```
Expand Down
11 changes: 10 additions & 1 deletion src/macros.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ See also: [`@set`](@ref), [`@local`](@ref)
## Examples
```julia
using OhMyThreads: @tasks
```
```julia
@tasks for i in 1:3
println(i)
Expand Down Expand Up @@ -109,9 +113,14 @@ end
## Examples
```julia
using OhMyThreads: @tasks
using OhMyThreads.Tools: taskid
@tasks for i in 1:10
@set scheduler=DynamicScheduler(; nchunks=2)
@set begin
scheduler=:dynamic
ntasks=2
end
@local x = zeros(3) # TLV
x .+= 1
Expand Down
4 changes: 3 additions & 1 deletion src/tools.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ module Tools
using Base.Threads: nthreads

"""
nthtid(n)
Returns the thread id of the `n`th Julia thread in the `:default` threadpool.
"""
@inline function nthtid(n)
Expand All @@ -18,7 +20,7 @@ end
"""
taskid() :: UInt
Return a `UInt` identifier for the current running [Task](https://docs.julialang.org/en/v1/base/parallel/#Core.Task). This identifier will be unique so long as references to the task it came from still exist.
Return a `UInt` identifier for the current running [Task](https://docs.julialang.org/en/v1/base/parallel/#Core.Task). This identifier will be unique so long as references to the task it came from still exist.
"""
taskid() = objectid(current_task())

Expand Down

0 comments on commit aeef73e

Please sign in to comment.