| 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; |
no test coverage detected