Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
张磊
/
FileStorageBeego
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
03eb1fc1
authored
2014-08-21 15:56:34 +0800
by
astaxie
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
toolbox: add notify when add & delete task
1 parent
0a967875
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
0 deletions
toolbox/task.go
toolbox/task.go
View file @
03eb1fc
...
...
@@ -33,6 +33,7 @@ type bounds struct {
var
(
AdminTaskList
map
[
string
]
Tasker
stop
chan
bool
changed
chan
bool
seconds
=
bounds
{
0
,
59
,
nil
}
minutes
=
bounds
{
0
,
59
,
nil
}
hours
=
bounds
{
0
,
23
,
nil
}
...
...
@@ -411,6 +412,8 @@ func run() {
e
.
SetNext
(
effective
)
}
continue
case
<-
changed
:
continue
case
<-
stop
:
return
}
...
...
@@ -425,6 +428,13 @@ func StopTask() {
// add task with name
func
AddTask
(
taskname
string
,
t
Tasker
)
{
AdminTaskList
[
taskname
]
=
t
changed
<-
true
}
// add task with name
func
DeleteTask
(
taskname
string
)
{
delete
(
AdminTaskList
,
taskname
)
changed
<-
true
}
// sort map for tasker
...
...
@@ -578,4 +588,5 @@ func all(r bounds) uint64 {
func
init
()
{
AdminTaskList
=
make
(
map
[
string
]
Tasker
)
stop
=
make
(
chan
bool
)
changed
=
make
(
chan
bool
)
}
...
...
Write
Preview
Styling with
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment