This function should find connected components in binary matrix, which are represented by 1\'s.
How can I make it multithreaded without making extra connected components?