thread count array function