jackfirth / racket-disposable

An experimental Racket library providing an abstraction for values associated with external resources that allows automatic resource pooling, per-thread virtual construction, and monadic composition
Apache License 2.0
7 stars 0 forks source link

Replace manager abstraction with an atomic box #80

Closed jackfirth closed 7 years ago

jackfirth commented 7 years ago

Closes #77

This cleanly separates the thread safe atomic mutable logic of a pool’s current state from the representation of that state, making it easier to reason about. Additionally, lease structures no longer contain boxes, leaving the only stateful components of pools to be the atomic box containing its leases and idle values and the semaphore it uses to coordinate between clients returning leases and clients waiting on leases from a full pool.

This also fixes a similar problem that map/async in disposable/main had where exceptions thrown during pool value deallocation were silently swallowed.

codecov[bot] commented 7 years ago

Codecov Report

Merging #80 into master will not change coverage. The diff coverage is 100%.

Impacted file tree graph

@@          Coverage Diff          @@
##           master    #80   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files          15     15           
  Lines         824    877   +53     
=====================================
+ Hits          824    877   +53
Impacted Files Coverage Δ
disposable/private/pool.rkt 100% <100%> (ø) :arrow_up:
disposable/private/atomic-box.rkt 100% <100%> (ø)
disposable/main.rkt 100% <100%> (ø) :arrow_up:
disposable/testing.rkt 100% <100%> (ø) :arrow_up:
disposable/scribblings/main.scrbl 100% <0%> (ø) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 7d5d164...bc01e00. Read the comment docs.