Skip to content

Commit ce70078

Browse files
committed
has_parallel_toolbox(): better algorithm
1 parent 6a13b08 commit ce70078

1 file changed

Lines changed: 11 additions & 7 deletions

File tree

+stdlib/has_parallel_toolbox.m

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,18 @@
55

66
function y = has_parallel_toolbox()
77

8-
try
9-
gcp('nocreate');
10-
y = true;
11-
catch e
12-
if ~strcmp(e.identifier, 'MATLAB:UndefinedFunction')
13-
rethrow(e)
8+
if ~stdlib.matlabOlderThan('R2020b')
9+
y = canUseParallelPool();
10+
else
11+
try
12+
gcp('nocreate');
13+
y = true;
14+
catch e
15+
if ~strcmp(e.identifier, 'MATLAB:UndefinedFunction')
16+
rethrow(e)
17+
end
18+
y = false;
1419
end
15-
y = false;
1620
end
1721

1822
end

0 commit comments

Comments
 (0)