MCPcopy Create free account
hub / github.com/MegEngine/MegFlow / store

Method store

flow-rs/src/loader/python/context.rs:42–56  ·  view source on GitHub ↗
(&mut self)

Source from the content-addressed store, hash-verified

40
41impl ContextPool {
42 fn store(&mut self) -> usize {
43 let id = self.freelist.pop().unwrap_or(self.pool.len());
44 if id == self.pool.len() {
45 self.pool.push(Context {
46 thread: std::ptr::null_mut(),
47 ctx: Default::default(),
48 })
49 }
50 unsafe {
51 let context = self.pool.get_unchecked_mut(id);
52 context.thread = ffi::PyThreadState_Get();
53 context.ctx = unlimited::store(context.thread);
54 }
55 id
56 }
57
58 fn restore(&mut self, id: usize) {
59 unsafe {

Callers 6

runMethod · 0.80
closeMethod · 0.80
disableMethod · 0.80
resetFunction · 0.80
recv_anyMethod · 0.80
with_contextFunction · 0.80

Calls 4

storeFunction · 0.85
popMethod · 0.80
pushMethod · 0.80
lenMethod · 0.45

Tested by

no test coverage detected