mirror of
https://github.com/shadow1ng/fscan.git
synced 2026-09-22 03:10:42 +08:00
improve embedded scanner runtime
This commit is contained in:
@@ -17,23 +17,6 @@ func SetResultCallback(cb ResultCallback) {
|
||||
resultCallback = cb
|
||||
}
|
||||
|
||||
// ReplaceResultCallback temporarily replaces the result callback and returns a
|
||||
// restore function. This is useful for embedded callers that need to collect
|
||||
// structured results without permanently stealing the callback from another
|
||||
// subsystem.
|
||||
func ReplaceResultCallback(cb ResultCallback) func() {
|
||||
callbackMu.Lock()
|
||||
previous := resultCallback
|
||||
resultCallback = cb
|
||||
callbackMu.Unlock()
|
||||
|
||||
return func() {
|
||||
callbackMu.Lock()
|
||||
resultCallback = previous
|
||||
callbackMu.Unlock()
|
||||
}
|
||||
}
|
||||
|
||||
// NotifyResult 通知结果给回调函数
|
||||
func NotifyResult(result interface{}) {
|
||||
callbackMu.RLock()
|
||||
|
||||
Reference in New Issue
Block a user