Skip to content

Commit

Permalink
refactor: tasker post stop
Browse files Browse the repository at this point in the history
  • Loading branch information
dongwlin committed Dec 5, 2024
1 parent 55c3ee8 commit e107bd6
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion internal/maa/framework.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ var (
MaaTaskerStatus func(tasker uintptr, id int64) int32
MaaTaskerWait func(tasker uintptr, id int64) int32
MaaTaskerRunning func(tasker uintptr) bool
MaaTaskerPostStop func(tasker uintptr) bool
MaaTaskerPostStop func(tasker uintptr) int64
MaaTaskerGetResource func(tasker uintptr) uintptr
MaaTaskerGetController func(tasker uintptr) uintptr
MaaTaskerClearCache func(tasker uintptr) bool
Expand Down
5 changes: 3 additions & 2 deletions tasker.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,9 @@ func (t *Tasker) Running() bool {
}

// PostStop posts a stop signal to the tasker.
func (t *Tasker) PostStop() bool {
return maa.MaaTaskerPostStop(t.handle)
func (t *Tasker) PostStop() *TaskJob {
id := maa.MaaTaskerPostStop(t.handle)
return NewTaskJob(id, t.status, t.wait, t.getTaskDetail)
}

// GetResource returns the resource handle of the tasker.
Expand Down
2 changes: 1 addition & 1 deletion tasker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ func TestTasker_PostStop(t *testing.T) {
taskerBind(t, tasker, ctrl, res)

got := tasker.PostStop()
require.True(t, got)
require.NotNil(t, got)
}

func TestTasker_GetResource(t *testing.T) {
Expand Down

0 comments on commit e107bd6

Please sign in to comment.