% call from terminal by typing (without the quotes): "octave bug_demo.m" 

% housekeeping
clc; clear; close all;

% load package
pkg load parallel

% generate test matrices
s = 2;
A = rand(s)
B = rand(s)

% process sequentially
u1 = fft2(A) % works fine
u2 = fft2(B) % works fine

% put args into cell array
argCell{1} = A;
argCell{2} = B

% process in parallel 
num_processes = 4;

% first try with sine function
u3 = parcellfun(num_processes, @sin, argCell, "VerboseLevel", 3) % works fine

% then try with fft2 function
disp('Will the next call to parcellfun ever finish?') 
u4 = parcellfun(num_processes, @fft2, argCell, "VerboseLevel", 3) % hangs

