Skip to content
This repository was archived by the owner on May 6, 2021. It is now read-only.

Commit 7d06c21

Browse files
authored
Extend MultiThreadEnv to accept a vector of environments (#108)
* extend MultiThreadEnv
1 parent 1eb14f3 commit 7d06c21

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/environments/wrappers/MultiThreadEnv.jl

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,15 @@ function Base.show(io::IO, t::MIME"text/markdown", env::MultiThreadEnv)
2424
show(io, t, Markdown.parse(s))
2525
end
2626

27-
function MultiThreadEnv(f, n)
28-
envs = [f() for _ in 1:n]
27+
"""
28+
MultiThreadEnv(f, n::Int)
29+
30+
`f` is a lambda function which creates an `AbstractEnv` by calling `f()`.
31+
"""
32+
MultiThreadEnv(f, n::Int) = MultiThreadEnv([f() for _ in 1:n])
2933

34+
function MultiThreadEnv(envs::Vector{<:AbstractEnv})
35+
n = length(envs)
3036
S = state_space(envs[1])
3137
s = state(envs[1])
3238
if S isa Space

0 commit comments

Comments
 (0)