mirror of
https://github.com/cuberite/libevent.git
synced 2025-09-10 13:04:23 -04:00
Merge remote-tracking branch 'origin/patches-2.0'
This commit is contained in:
commit
0e95950e60
@ -97,7 +97,7 @@ SUBDIRS = . include sample test
|
||||
|
||||
if BUILD_WIN32
|
||||
|
||||
SYS_LIBS = -lws2_32
|
||||
SYS_LIBS = -lws2_32 -lshell32 -ladvapi32
|
||||
SYS_SRC = win32select.c evthread_win32.c buffer_iocp.c event_iocp.c \
|
||||
bufferevent_async.c
|
||||
SYS_INCLUDES = -IWIN32-Code
|
||||
|
@ -39,6 +39,7 @@ dnl the 'host' machine is where the resulting stuff runs.
|
||||
|
||||
dnl Checks for programs.
|
||||
AC_PROG_CC
|
||||
AM_PROG_CC_C_O
|
||||
AC_PROG_INSTALL
|
||||
AC_PROG_LN_S
|
||||
# AC_PROG_MKDIR_P - $(MKDIR_P) should be defined by AM_INIT_AUTOMAKE
|
||||
@ -148,8 +149,7 @@ AC_SEARCH_LIBS([SSL_new], [ssl],
|
||||
[have_openssl=yes
|
||||
OPENSSL_LIBS="$LIBS -lcrypto $EV_LIB_GDI $EV_LIB_WS32"
|
||||
AC_DEFINE(HAVE_OPENSSL, 1, [Define if the system has openssl])],
|
||||
[have_openssl=no
|
||||
AC_DEFINE(HAVE_OPENSSL, 0, [Define if the system lacks openssl])],
|
||||
[have_openssl=no],
|
||||
[-lcrypto $EV_LIB_GDI $EV_LIB_WS32])
|
||||
LIBS="$save_LIBS"
|
||||
AC_SUBST(OPENSSL_LIBS)
|
||||
|
@ -19,6 +19,9 @@
|
||||
#include <windows.h>
|
||||
#include <io.h>
|
||||
#include <fcntl.h>
|
||||
#ifndef S_ISDIR
|
||||
#define S_ISDIR(x) (((x) & S_IFMT) == S_IFDIR)
|
||||
#endif
|
||||
#else
|
||||
#include <sys/stat.h>
|
||||
#include <sys/socket.h>
|
||||
|
@ -54,8 +54,7 @@ regress_SOURCES += regress_iocp.c
|
||||
endif
|
||||
|
||||
regress_LDADD = $(LIBEVENT_GC_SECTIONS) ../libevent.la $(PTHREAD_LIBS) $(ZLIB_LIBS)
|
||||
regress_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/compat \
|
||||
-I$(top_srcdir)/include -I../include $(PTHREAD_CFLAGS) $(ZLIB_CFLAGS)
|
||||
regress_CPPFLAGS = $(AM_CPPFLAGS) $(PTHREAD_CFLAGS) $(ZLIB_CFLAGS)
|
||||
regress_LDFLAGS = $(PTHREAD_CFLAGS)
|
||||
|
||||
if OPENSSL
|
||||
|
@ -37,8 +37,11 @@
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#ifdef _EVENT_HAVE_SYS_TIME_H
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
#ifdef WIN32
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#else
|
||||
#include <sys/socket.h>
|
||||
@ -49,7 +52,9 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#ifdef _EVENT_HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#include <errno.h>
|
||||
|
||||
#include <event.h>
|
||||
@ -102,12 +107,12 @@ run_once(void)
|
||||
count = 0;
|
||||
writes = num_writes;
|
||||
{ int xcount = 0;
|
||||
gettimeofday(&ts, NULL);
|
||||
evutil_gettimeofday(&ts, NULL);
|
||||
do {
|
||||
event_loop(EVLOOP_ONCE | EVLOOP_NONBLOCK);
|
||||
xcount++;
|
||||
} while (count != fired);
|
||||
gettimeofday(&te, NULL);
|
||||
evutil_gettimeofday(&te, NULL);
|
||||
|
||||
if (xcount != count) fprintf(stderr, "Xcount: %d, Rcount: %d\n", xcount, count);
|
||||
}
|
||||
|
@ -29,8 +29,11 @@
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#ifdef _EVENT_HAVE_SYS_TIME_H
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
#ifdef WIN32
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#else
|
||||
#include <sys/socket.h>
|
||||
@ -41,7 +44,9 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#ifdef _EVENT_HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#include <errno.h>
|
||||
|
||||
#include <event.h>
|
||||
@ -92,7 +97,7 @@ run_once(int num_pipes)
|
||||
}
|
||||
|
||||
/* measurements includes event setup */
|
||||
gettimeofday(&ts, NULL);
|
||||
evutil_gettimeofday(&ts, NULL);
|
||||
|
||||
/* provide a default timeout for events */
|
||||
evutil_timerclear(&tv_timeout);
|
||||
@ -111,7 +116,7 @@ run_once(int num_pipes)
|
||||
|
||||
event_dispatch();
|
||||
|
||||
gettimeofday(&te, NULL);
|
||||
evutil_gettimeofday(&te, NULL);
|
||||
evutil_timersub(&te, &ts, &te);
|
||||
|
||||
for (cp = pipes, i = 0; i < num_pipes; i++, cp += 2) {
|
||||
|
@ -88,7 +88,7 @@ errorcb(struct bufferevent *b, short what, void *arg)
|
||||
if (what & BEV_EVENT_EOF) {
|
||||
++total_n_handled;
|
||||
total_n_bytes += ri->n_read;
|
||||
gettimeofday(&now, NULL);
|
||||
evutil_gettimeofday(&now, NULL);
|
||||
evutil_timersub(&now, &ri->started, &diff);
|
||||
evutil_timeradd(&diff, &total_time, &total_time);
|
||||
|
||||
@ -152,7 +152,7 @@ launch_request(void)
|
||||
|
||||
ri = malloc(sizeof(*ri));
|
||||
ri->n_read = 0;
|
||||
gettimeofday(&ri->started, NULL);
|
||||
evutil_gettimeofday(&ri->started, NULL);
|
||||
|
||||
b = bufferevent_socket_new(base, sock, BEV_OPT_CLOSE_ON_FREE);
|
||||
|
||||
@ -184,11 +184,11 @@ main(int argc, char **argv)
|
||||
perror("launch");
|
||||
}
|
||||
|
||||
gettimeofday(&start, NULL);
|
||||
evutil_gettimeofday(&start, NULL);
|
||||
|
||||
event_base_dispatch(base);
|
||||
|
||||
gettimeofday(&end, NULL);
|
||||
evutil_gettimeofday(&end, NULL);
|
||||
evutil_timersub(&end, &start, &total);
|
||||
usec = total_time.tv_sec * 1000000 + total_time.tv_usec;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user