Qualcomm Interview Question

Write strstr() code. Solutions to avoid race condition?