{
struct internal_config *internal_conf =
eal_get_internal_configuration();
+
+ eal_intr_thread_cancel();
/* after this point, any DPDK pointers will become dangling */
rte_eal_memory_detach();
eal_cleanup_config(internal_conf);
#include "eal_private.h"
#include "eal_windows.h"
+#define IOCP_KEY_SHUTDOWN UINT32_MAX
+
static pthread_t intr_thread;
static HANDLE intr_iocp;
static void *
eal_intr_thread_main(LPVOID arg __rte_unused)
{
+ bool finished = false;
+
if (eal_intr_thread_handle_init() < 0) {
RTE_LOG(ERR, EAL, "Cannot open interrupt thread handle\n");
goto cleanup;
}
- while (1) {
+ while (!finished) {
OVERLAPPED_ENTRY events[16];
ULONG event_count, i;
BOOL result;
continue;
}
- for (i = 0; i < event_count; i++)
+ for (i = 0; i < event_count; i++) {
+ if (events[i].lpCompletionKey == IOCP_KEY_SHUTDOWN) {
+ finished = true;
+ break;
+ }
eal_intr_process(&events[i]);
+ }
}
CloseHandle(intr_thread_handle);
return 0;
}
+void
+eal_intr_thread_cancel(void)
+{
+ if (!PostQueuedCompletionStatus(
+ intr_iocp, 0, IOCP_KEY_SHUTDOWN, NULL)) {
+ RTE_LOG_WIN32_ERR("PostQueuedCompletionStatus()");
+ RTE_LOG(ERR, EAL, "Cannot cancel interrupt thread\n");
+ return;
+ }
+
+ WaitForSingleObject(intr_thread_handle, INFINITE);
+}
+
int
rte_intr_callback_register(
__rte_unused const struct rte_intr_handle *intr_handle,
*/
int eal_intr_thread_schedule(void (*func)(void *arg), void *arg);
+/**
+ * Request interrupt thread to stop and wait its termination.
+ */
+void eal_intr_thread_cancel(void);
+
/**
* Open virt2phys driver interface device.
*