let create set_up tear_down test_ctxt =
  let fixture = set_up test_ctxt in
  let tear_down test_ctxt =
    tear_down fixture test_ctxt
  in
    OUnitShared.Mutex.with_lock
      test_ctxt.shared test_ctxt.tear_down_mutex
      (fun () ->
         test_ctxt.tear_down <- tear_down :: test_ctxt.tear_down);
    fixture