Add scope definition functions
This commit is contained in:
parent
0622f9248c
commit
9f96e7b7c8
1 changed files with 16 additions and 0 deletions
|
|
@ -110,6 +110,22 @@
|
|||
([obj type] (serialize obj type (ResourceScope/newImplicitScope)))
|
||||
([obj type scope] (serialize* obj type (alloc-instance type scope) scope)))
|
||||
|
||||
(defn stack-scope
|
||||
"Constructs a new scope for use only in this thread.
|
||||
|
||||
The memory allocated within this scope is cheap to allocate, like a native
|
||||
stack."
|
||||
[]
|
||||
(ResourceScope/newConfinedScope))
|
||||
|
||||
(defn shared-scope
|
||||
"Constructs a new shared scope.
|
||||
|
||||
This scope can be shared across threads and memory allocated in it will only
|
||||
be cleaned up once every thread accessing the scope closes it."
|
||||
[]
|
||||
(ResourceScope/newSharedScope))
|
||||
|
||||
(comment
|
||||
;;; Prospective syntax for ffi
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue