JITCache is designed specifically for this purpose. Re-entrant callbacks can be blocked and the computation only run once.