diff --git a/src/maps/perf_event_array.cpp b/src/maps/perf_event_array.cpp index a14d11b..cfebb3d 100644 --- a/src/maps/perf_event_array.cpp +++ b/src/maps/perf_event_array.cpp @@ -89,13 +89,12 @@ void PerfEventArray::lost_callback_wrapper(void *ctx, int cpu, unsigned long long cnt) { auto *self = static_cast(ctx); - if (self->lost_callback_.is_none()) { - return; - } - py::gil_scoped_acquire acquire; try { + if (self->lost_callback_.is_none()) { + return; + } self->lost_callback_(cpu, cnt); } catch (const py::error_already_set &e) { PyErr_Print(); diff --git a/src/maps/perf_event_array.h b/src/maps/perf_event_array.h index 1b75440..9f77454 100644 --- a/src/maps/perf_event_array.h +++ b/src/maps/perf_event_array.h @@ -2,10 +2,10 @@ #define PYLIBBPF_PERF_EVENT_ARRAY_H #include +#include #include #include #include -#include class StructParser; class BpfMap;