#include <string.h>
#include <time.h>
#include <limits.h>
+#ifdef EVENT__HAVE_FCNTL_H
+#include <fcntl.h>
+#endif
#include "event2/event.h"
#include "event2/event_struct.h"
{
struct event_debug_entry *dent, find;
- if (!event_debug_mode_on_) {
+ if (!event_debug_mode_on_)
goto out;
- }
find.ptr = ev;
EVLOCK_LOCK(event_debug_map_lock_, 0);
{
struct event_debug_entry *dent, find;
- if (!event_debug_mode_on_) {
+ if (!event_debug_mode_on_)
goto out;
- }
find.ptr = ev;
EVLOCK_LOCK(event_debug_map_lock_, 0);
{
struct event_debug_entry *dent,find;
- if (!event_debug_mode_on_) {
+ if (!event_debug_mode_on_)
goto out;
- }
find.ptr = ev;
EVLOCK_LOCK(event_debug_map_lock_, 0);
{
struct event_debug_entry *dent, find;
- if (!event_debug_mode_on_) {
+ if (!event_debug_mode_on_)
goto out;
- }
find.ptr = ev;
EVLOCK_LOCK(event_debug_map_lock_, 0);
{
struct event_debug_entry *dent, find;
- if (!event_debug_mode_on_) {
+ if (!event_debug_mode_on_)
return;
- }
find.ptr = ev;
EVLOCK_LOCK(event_debug_map_lock_, 0);
{
struct event_debug_entry *dent, find;
- if (!event_debug_mode_on_) {
+ if (!event_debug_mode_on_)
return;
- }
find.ptr = ev;
EVLOCK_LOCK(event_debug_map_lock_, 0);
}
EVLOCK_UNLOCK(event_debug_map_lock_, 0);
}
+static void event_debug_assert_socket_nonblocking_(evutil_socket_t fd)
+{
+ int flags;
+
+ if (!event_debug_mode_on_)
+ return;
+
+#ifndef _WIN32
+ if ((flags = fcntl(fd, F_GETFL, NULL)) >= 0) {
+ EVUTIL_ASSERT(flags & O_NONBLOCK);
+ }
+#else
+ (void)flags;
+#endif
+}
#else
static void event_debug_note_setup_(const struct event *ev) { (void)ev; }
static void event_debug_note_teardown_(const struct event *ev) { (void)ev; }
static void event_debug_note_del_(const struct event *ev) { (void)ev; }
static void event_debug_assert_is_setup_(const struct event *ev) { (void)ev; }
static void event_debug_assert_not_added_(const struct event *ev) { (void)ev; }
+static void event_debug_assert_socket_nonblocking_(evutil_socket_t fd) { (void)fd; }
#endif
#define EVENT_BASE_ASSERT_LOCKED(base) \
if (arg == &event_self_cbarg_ptr_)
arg = ev;
+ if (!(events & EV_SIGNAL))
+ event_debug_assert_socket_nonblocking_(fd);
event_debug_assert_not_added_(ev);
ev->ev_base = base;