changed threading to proper threads module instead of fork()

changed to proper threads module instead of fork() based. created
function with semaphore to manage un/pw selection