diff options
| author | flysand7 <thebumboni@gmail.com> | 2024-09-14 10:46:35 +1100 |
|---|---|---|
| committer | flysand7 <thebumboni@gmail.com> | 2024-09-14 10:46:35 +1100 |
| commit | 016d1a84d4e09ea06491d9e5a4661e313906e3aa (patch) | |
| tree | c14ce4a701d9fffc2ec67af25b9bac7a902e0890 /core/mem/mutex_allocator.odin | |
| parent | 3ed2ab6e2c18081d80961168a57155e6f31ac573 (diff) | |
[mem]: Document mutex, rollback stack and tracking allocators
Diffstat (limited to 'core/mem/mutex_allocator.odin')
| -rw-r--r-- | core/mem/mutex_allocator.odin | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/core/mem/mutex_allocator.odin b/core/mem/mutex_allocator.odin index 1cccc7dac..d2c527fdb 100644 --- a/core/mem/mutex_allocator.odin +++ b/core/mem/mutex_allocator.odin @@ -3,16 +3,31 @@ package mem import "core:sync" +/* +The data for mutex allocator. +*/ Mutex_Allocator :: struct { backing: Allocator, mutex: sync.Mutex, } +/* +Initialize the mutex allocator. + +This procedure initializes the mutex allocator using `backin_allocator` as the +allocator that will be used to pass all allocation requests through. +*/ mutex_allocator_init :: proc(m: ^Mutex_Allocator, backing_allocator: Allocator) { m.backing = backing_allocator m.mutex = {} } +/* +Mutex allocator. + +The mutex allocator is a wrapper for allocators that is used to serialize all +allocator requests across multiple threads. +*/ @(require_results) mutex_allocator :: proc(m: ^Mutex_Allocator) -> Allocator { return Allocator{ |