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
52e3be5c
Commit
52e3be5c
authored
Sep 02, 2013
by
Sergey Lyubka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactored f[un]lockfile for Windows using LockFileEx/UnlockFileEx
parent
cd6005c8
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
4 deletions
+4
-4
mongoose.c
mongoose.c
+4
-4
No files found.
mongoose.c
View file @
52e3be5c
...
...
@@ -140,8 +140,10 @@ typedef long off_t;
#define fdopen(x, y) _fdopen((x), (y))
#define write(x, y, z) _write((x), (y), (unsigned) z)
#define read(x, y, z) _read((x), (y), (unsigned) z)
#define flockfile(x) EnterCriticalSection(&global_log_file_lock)
#define funlockfile(x) LeaveCriticalSection(&global_log_file_lock)
#define flockfile(x) LockFileEx((HANDLE) _get_osfhandle(_fileno(x)), \
LOCKFILE_FAIL_IMMEDIATELY
|
LOCKFILE_EXCLUSIVE_LOCK
,
0
,
0
,
0
,
NULL
)
#define funlockfile(x) UnlockFileEx((HANDLE) _get_osfhandle(_fileno(x)), \
0
,
0
,
0
,
NULL
)
#define sleep(x) Sleep((x) * 1000)
#define rmdir(x) _rmdir(x)
...
...
@@ -255,7 +257,6 @@ typedef int SOCKET;
#define ARRAY_SIZE(array) (sizeof(array) / sizeof(array[0]))
#ifdef _WIN32
static
CRITICAL_SECTION
global_log_file_lock
;
static
pthread_t
pthread_self
(
void
)
{
return
GetCurrentThreadId
();
}
...
...
@@ -5371,7 +5372,6 @@ struct mg_context *mg_start(const struct mg_callbacks *callbacks,
#if defined(_WIN32) && !defined(__SYMBIAN32__)
WSADATA
data
;
WSAStartup
(
MAKEWORD
(
2
,
2
),
&
data
);
InitializeCriticalSection
(
&
global_log_file_lock
);
#endif // _WIN32
// Allocate context and initialize reasonable general case defaults.
...
...
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