MCPcopy Create free account
hub / github.com/GaijinEntertainment/daScript / array_lock

Function array_lock

src/simulate/runtime_array.cpp:27–44  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

25 }
26
27 void array_lock ( Context & context, Array & arr, LineInfo * at ) {
28 if ( arr.shared || arr.hopeless ) return;
29 if ( arr.lock==0 ) {
30 if ( arr.magic != 0 ) {
31 context.throw_error_at(at, "array magic mismatch on first lock, was it moved or overwritten?");
32 }
33 arr.lock = 1;
34 arr.magic = DAS_ARRAY_MAGIC;
35 } else {
36 if ( arr.magic != DAS_ARRAY_MAGIC ) {
37 context.throw_error_at(at, "array magic mismatch on lock, was it moved or overwritten?");
38 }
39 arr.lock ++;
40 if ( arr.lock==0 ) {
41 context.throw_error_at(at, "array lock overflow, was it moved or overwritten?");
42 }
43 }
44 }
45
46 void array_unlock ( Context & context, Array & arr, LineInfo * at ) {
47 if ( arr.shared || arr.hopeless ) return;

Calls 1

throw_error_atMethod · 0.80

Tested by

no test coverage detected