-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add ActionRegistry
replacement for TempRegistry
#484
Conversation
ee61973
to
4888580
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So just trying to summarise the changes vs TempRegistry
:
- better naming (commit / release of actions rather than temp and frees resources)
- no support for sharing a registry between threads, but hence also cheaper (IORefs rather than MVars)
- generally cheaper: simple LIFO lists rather than maps
We need SPECIALISE
pragmas everywhere in the ActionRegistry.hs
.
It looks like ActionRegistry
would be a good place to insert tests for exception safety. We could use fs-sim style exception testing to throw exceptions at random points within a transaction (when actions are registered) and verify that everything gets cleaned up properly.
4888580
to
c7d19f4
Compare
Yes, and other changes I can think of:
Yes, good point. Added them.
I have some uncommitted tests for this using |
cc52e46
to
9934b2d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Squash fixups and merge I say.
738e376
to
2f396e9
Compare
I've reworked the
TempRegistry
implementation a bit, and I've renamed it toActionRegistry
to better reflect that it is a registry of monadic actions. TheActionRegistry
is introduced in a new module so that theTempRegistry
can largely remain in use, which makes the diff of this PR smaller. The intent is to replace every use ofTempRegistry
byActionRegistry
eventually, probably in a few follow-up PRs. For now, there are two places where we do the replacement already:openSession
andcloseSession
. I've also taken the liberty to revisitopenSession
andcloseSession
a bit to make them more exception safe