Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
M
mongoose
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
esp
mongoose
Commits
9d4d48e7
Commit
9d4d48e7
authored
Mar 13, 2012
by
Sergey Lyubka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Using mg_sleep() instead of sleep()
parent
108a9739
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
3 deletions
+4
-3
mongoose.c
mongoose.c
+4
-3
No files found.
mongoose.c
View file @
9d4d48e7
...
@@ -113,7 +113,7 @@ typedef long off_t;
...
@@ -113,7 +113,7 @@ typedef long off_t;
#define SHUT_WR 1
#define SHUT_WR 1
#define snprintf _snprintf
#define snprintf _snprintf
#define vsnprintf _vsnprintf
#define vsnprintf _vsnprintf
#define
sleep(x) Sleep((x) * 1000
)
#define
mg_sleep(x) Sleep(x
)
#define pipe(x) _pipe(x, BUFSIZ, _O_BINARY)
#define pipe(x) _pipe(x, BUFSIZ, _O_BINARY)
#define popen(x, y) _popen(x, y)
#define popen(x, y) _popen(x, y)
...
@@ -206,6 +206,7 @@ typedef struct DIR {
...
@@ -206,6 +206,7 @@ typedef struct DIR {
#define mg_mkdir(x, y) mkdir(x, y)
#define mg_mkdir(x, y) mkdir(x, y)
#define mg_remove(x) remove(x)
#define mg_remove(x) remove(x)
#define mg_rename(x, y) rename(x, y)
#define mg_rename(x, y) rename(x, y)
#define mg_sleep(x) usleep((x) * 1000)
#define ERRNO errno
#define ERRNO errno
#define INVALID_SOCKET (-1)
#define INVALID_SOCKET (-1)
#define INT64_FMT PRId64
#define INT64_FMT PRId64
...
@@ -4079,7 +4080,7 @@ static void master_thread(struct mg_context *ctx) {
...
@@ -4079,7 +4080,7 @@ static void master_thread(struct mg_context *ctx) {
// On windows, if read_set and write_set are empty,
// On windows, if read_set and write_set are empty,
// select() returns "Invalid parameter" error
// select() returns "Invalid parameter" error
// (at least on my Windows XP Pro). So in this case, we sleep here.
// (at least on my Windows XP Pro). So in this case, we sleep here.
sleep
(
1
);
mg_sleep
(
1000
);
#endif // _WIN32
#endif // _WIN32
}
else
{
}
else
{
for
(
sp
=
ctx
->
listening_sockets
;
sp
!=
NULL
;
sp
=
sp
->
next
)
{
for
(
sp
=
ctx
->
listening_sockets
;
sp
!=
NULL
;
sp
=
sp
->
next
)
{
...
@@ -4148,7 +4149,7 @@ void mg_stop(struct mg_context *ctx) {
...
@@ -4148,7 +4149,7 @@ void mg_stop(struct mg_context *ctx) {
// Wait until mg_fini() stops
// Wait until mg_fini() stops
while
(
ctx
->
stop_flag
!=
2
)
{
while
(
ctx
->
stop_flag
!=
2
)
{
(
void
)
sleep
(
0
);
mg_sleep
(
1
0
);
}
}
free_context
(
ctx
);
free_context
(
ctx
);
...
...
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