Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
J
jlib
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
captainwong
jlib
Commits
edea5c85
Commit
edea5c85
authored
4 years ago
by
captainwong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
1da70634
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
2 deletions
+18
-2
Client.cpp
jlib/net/Client.cpp
+17
-2
simple_libevent_client.vcxproj
test/simple_libevent_client/simple_libevent_client.vcxproj
+1
-0
No files found.
jlib/net/Client.cpp
View file @
edea5c85
#include "Client.h"
#ifdef _WIN32
#include <WinSock2.h>
#pragma comment(lib, "ws2_32.lib")
#else
#include <netinet/in.h>
#include <arpa/inet.h>
#include <sys/socket.h>
#endif
#include <errno.h>
#include <stdlib.h>
...
...
@@ -26,9 +31,19 @@ namespace net {
struct
OneTimeIniter
{
OneTimeIniter
()
{
#ifdef _WIN32
WSADATA
wsa_data
;
WSAStartup
(
0x0201
,
&
wsa_data
);
if
(
0
!=
evthread_use_windows_threads
())
{
JLOG_CRTC
(
"failed to init libevent with thread by calling evthread_use_windows_threads"
);
fprintf
(
stderr
,
"failed to init libevent with thread by calling evthread_use_windows_threads
\n
"
);
abort
();
}
#else
if
(
0
!=
evthread_use_pthreads
())
{
fprintf
(
stderr
,
"failed to init libevent with thread by calling evthread_use_pthreads
\n
"
);
abort
();
}
#endif
}
};
...
...
This diff is collapsed.
Click to expand it.
test/simple_libevent_client/simple_libevent_client.vcxproj
View file @
edea5c85
...
...
@@ -121,6 +121,7 @@
<PrecompiledHeader>
NotUsing
</PrecompiledHeader>
<PrecompiledHeaderFile>
pch.h
</PrecompiledHeaderFile>
<AdditionalIncludeDirectories>
$(DEVLIBS)\libevent-2.1.12-stable-install\include;%(AdditionalIncludeDirectories)
</AdditionalIncludeDirectories>
<RuntimeLibrary>
MultiThreaded
</RuntimeLibrary>
</ClCompile>
<Link>
<SubSystem>
...
...
This diff is collapsed.
Click to expand it.
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