Skip to content

Commit a7e6d01

Browse files
dongwlinCopilot
andcommitted
docs: add concurrency safety notes to Init, IsInited, and Release functions
Co-authored-by: Copilot <copilot@github.com>
1 parent 16debdd commit a7e6d01

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

maa.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ func WithJSONDecoder(decoder JSONDecoder) InitOption {
140140

141141
// Init loads the dynamic library related to the MAA framework and registers its related functions.
142142
// It must be called before invoking any other MAA-related functions.
143+
// It must not be called concurrently with Release or other MAA-related functions.
143144
// Note: If this function is not called before other MAA functions, it will trigger a null pointer panic.
144145
func Init(opts ...InitOption) error {
145146

@@ -207,11 +208,13 @@ func Init(opts ...InitOption) error {
207208
}
208209

209210
// IsInited checks if the MAA framework has been initialized.
211+
// It must not be called concurrently with Init or Release.
210212
func IsInited() bool {
211213
return inited
212214
}
213215

214216
// Release releases the dynamic library resources of the MAA framework and unregisters its related functions.
217+
// It must not be called concurrently with Init or other MAA-related functions.
215218
func Release() error {
216219

217220
if err := native.Shutdown(); err != nil {

0 commit comments

Comments
 (0)