summaryrefslogtreecommitdiff
path: root/gcell/src/lib/runtime/gc_job_manager.cc
diff options
context:
space:
mode:
Diffstat (limited to 'gcell/src/lib/runtime/gc_job_manager.cc')
-rw-r--r--gcell/src/lib/runtime/gc_job_manager.cc26
1 files changed, 26 insertions, 0 deletions
diff --git a/gcell/src/lib/runtime/gc_job_manager.cc b/gcell/src/lib/runtime/gc_job_manager.cc
index 9ede5e156..ac2e989a4 100644
--- a/gcell/src/lib/runtime/gc_job_manager.cc
+++ b/gcell/src/lib/runtime/gc_job_manager.cc
@@ -31,6 +31,19 @@
static boost::weak_ptr<gc_job_manager> s_singleton;
+// custom deleter of gc_job_desc allocated via alloc_job_desc_sptr
+class job_desc_deleter {
+ gc_job_manager_sptr d_mgr;
+public:
+ job_desc_deleter(gc_job_manager_sptr mgr) : d_mgr(mgr) {}
+
+ void operator()(gc_job_desc *jd) {
+ d_mgr->free_job_desc(jd);
+ }
+};
+
+
+
gc_job_manager_sptr
gc_make_job_manager(const gc_jm_options *options)
{
@@ -71,6 +84,19 @@ gc_job_manager::singleton()
return gc_job_manager_sptr(s_singleton);
}
+gc_job_desc_sptr
+gc_job_manager::make_jd_sptr(gc_job_manager_sptr mgr, gc_job_desc *jd)
+{
+ return gc_job_desc_sptr(jd, job_desc_deleter(mgr));
+}
+
+gc_job_desc_sptr
+gc_job_manager::alloc_job_desc(gc_job_manager_sptr mgr)
+{
+ return make_jd_sptr(mgr, mgr->alloc_job_desc());
+}
+
+
// ------------------------------------------------------------------------