File tree Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Original file line number Diff line number Diff line change 1- use std:: cell:: RefCell ;
21use std:: convert:: TryFrom ;
32use std:: mem:: MaybeUninit ;
43
54use anyhow:: anyhow;
65use anyhow:: Error ;
76use graph:: blockchain:: Blockchain ;
87use graph:: data_source:: subgraph;
8+ use graph:: parking_lot:: RwLock ;
99use graph:: util:: mem:: init_slice;
1010use semver:: Version ;
1111use wasmtime:: AsContext ;
@@ -168,7 +168,7 @@ pub struct AscHeapCtx {
168168 // is zeroed when initialized or grown.
169169 memory : Memory ,
170170
171- arena : RefCell < Arena > ,
171+ arena : RwLock < Arena > ,
172172}
173173
174174impl AscHeapCtx {
@@ -207,28 +207,28 @@ impl AscHeapCtx {
207207 Ok ( Arc :: new ( AscHeapCtx {
208208 memory_allocate,
209209 memory,
210- arena : RefCell :: new ( Arena :: new ( ) ) ,
210+ arena : RwLock :: new ( Arena :: new ( ) ) ,
211211 api_version,
212212 id_of_type,
213213 } ) )
214214 }
215215
216216 fn arena_start_ptr ( & self ) -> i32 {
217- self . arena . borrow ( ) . start
217+ self . arena . read ( ) . start
218218 }
219219
220220 fn arena_free_size ( & self ) -> i32 {
221- self . arena . borrow ( ) . size
221+ self . arena . read ( ) . size
222222 }
223223
224224 fn set_arena ( & self , start_ptr : i32 , size : i32 ) {
225- let mut arena = self . arena . borrow_mut ( ) ;
225+ let mut arena = self . arena . write ( ) ;
226226 arena. start = start_ptr;
227227 arena. size = size;
228228 }
229229
230230 fn allocated ( & self , size : i32 ) {
231- let mut arena = self . arena . borrow_mut ( ) ;
231+ let mut arena = self . arena . write ( ) ;
232232 arena. start += size;
233233 arena. size -= size;
234234 }
You can’t perform that action at this time.
0 commit comments