What synchronization and locking approaches would you use to prevent race conditions in a multithreaded program?