Making crefi threadsafe.

Signed-off-by: Vijaykumar Koppad <vijaykumar.koppad@gmail.com>