//go:build windows
// +build windows

package main

import (
	"os"
	"os/signal"
	"syscall"

	"ems.agt/lib/log"
)

// 启动一个 goroutine 监听信号量
func ReloadRoutine() {
	sigCh := make(chan os.Signal, 1)

	//signal.Notify(sigCh, syscall.SIGUSR1)

	signal.Notify(sigCh, syscall.SIGTRAP)

	for {
		<-sigCh
		log.Info("Received reload signal, reloading config...")

		err := ReadConfig(*ConfigFile)
		if err != nil {
			log.Error("Failed to ReadConfig:", err)
			continue
		}

		log.Info("Config reloaded successfully.")
	}
}
