Added argument passing in thread creation for buffer sharing.