Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
Nodemcu Firmware
Commits
0f771629
Commit
0f771629
authored
Oct 30, 2017
by
Philip Gladstone
Committed by
Marcel Stör
Oct 30, 2017
Browse files
Make the CRON module work reliably (#2153)
parent
ffc914da
Changes
1
Hide whitespace changes
Inline
Side-by-side
app/modules/cron.c
View file @
0f771629
...
@@ -104,7 +104,7 @@ static size_t lcron_findindex(lua_State *L, cronent_ud_t *ud) {
...
@@ -104,7 +104,7 @@ static size_t lcron_findindex(lua_State *L, cronent_ud_t *ud) {
size_t
i
;
size_t
i
;
for
(
i
=
0
;
i
<
cronent_count
;
i
++
)
{
for
(
i
=
0
;
i
<
cronent_count
;
i
++
)
{
lua_rawgeti
(
L
,
LUA_REGISTRYINDEX
,
cronent_list
[
i
]);
lua_rawgeti
(
L
,
LUA_REGISTRYINDEX
,
cronent_list
[
i
]);
eud
=
lua_touserdata
(
L
,
1
);
eud
=
lua_touserdata
(
L
,
-
1
);
lua_pop
(
L
,
1
);
lua_pop
(
L
,
1
);
if
(
eud
==
ud
)
break
;
if
(
eud
==
ud
)
break
;
}
}
...
@@ -141,7 +141,7 @@ static int lcron_unschedule(lua_State *L) {
...
@@ -141,7 +141,7 @@ static int lcron_unschedule(lua_State *L) {
size_t
i
=
lcron_findindex
(
L
,
ud
);
size_t
i
=
lcron_findindex
(
L
,
ud
);
if
(
i
==
-
1
)
return
0
;
if
(
i
==
-
1
)
return
0
;
luaL_unref
(
L
,
LUA_REGISTRYINDEX
,
cronent_list
[
i
]);
luaL_unref
(
L
,
LUA_REGISTRYINDEX
,
cronent_list
[
i
]);
memmove
(
cronent_list
+
i
,
cronent_list
+
i
+
1
,
sizeof
(
int
)
*
cronent_count
-
i
-
1
);
memmove
(
cronent_list
+
i
,
cronent_list
+
i
+
1
,
sizeof
(
int
)
*
(
cronent_count
-
i
-
1
)
)
;
cronent_count
--
;
cronent_count
--
;
return
0
;
return
0
;
}
}
...
@@ -173,7 +173,7 @@ static void cron_handle_time(uint8_t mon, uint8_t dom, uint8_t dow, uint8_t hour
...
@@ -173,7 +173,7 @@ static void cron_handle_time(uint8_t mon, uint8_t dom, uint8_t dow, uint8_t hour
desc
.
min
=
(
uint64_t
)
1
<<
min
;
desc
.
min
=
(
uint64_t
)
1
<<
min
;
for
(
size_t
i
=
0
;
i
<
cronent_count
;
i
++
)
{
for
(
size_t
i
=
0
;
i
<
cronent_count
;
i
++
)
{
lua_rawgeti
(
L
,
LUA_REGISTRYINDEX
,
cronent_list
[
i
]);
lua_rawgeti
(
L
,
LUA_REGISTRYINDEX
,
cronent_list
[
i
]);
cronent_ud_t
*
ent
=
lua_touserdata
(
L
,
1
);
cronent_ud_t
*
ent
=
lua_touserdata
(
L
,
-
1
);
lua_pop
(
L
,
1
);
lua_pop
(
L
,
1
);
if
((
ent
->
desc
.
mon
&
desc
.
mon
)
==
0
)
continue
;
if
((
ent
->
desc
.
mon
&
desc
.
mon
)
==
0
)
continue
;
if
((
ent
->
desc
.
dom
&
desc
.
dom
)
==
0
)
continue
;
if
((
ent
->
desc
.
dom
&
desc
.
dom
)
==
0
)
continue
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
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 comment