get returns the next available mark from the mark allocator.
()
| 716 | |
| 717 | // get returns the next available mark from the mark allocator. |
| 718 | func (ma *markAllocator) get() (uint32, error) { |
| 719 | ma.lock.Lock() |
| 720 | defer ma.lock.Unlock() |
| 721 | if len(ma.marks) == 0 { |
| 722 | return 0, errors.New("allocator exhausted") |
| 723 | } |
| 724 | mark := ma.marks[0] |
| 725 | ma.marks = ma.marks[1:] |
| 726 | return mark, nil |
| 727 | } |
| 728 | |
| 729 | // put returns the specified mark to the mark allocator. |
| 730 | func (ma *markAllocator) put(mark uint32) { |
no outgoing calls
no test coverage detected