add Lock to struct Ref.
diff --git a/include/thread.h b/include/thread.h index 0eb02b5..b4a1c94 100644 --- a/include/thread.h +++ b/include/thread.h
@@ -60,6 +60,7 @@ }; struct Ref { + Lock lk; long ref; };