The test/thread program is using key numbers of 0, which is illegal,
replace (0 <= keyno <= nkeys - 1) with (1 <= keyno <= nkeys).