开发者

Way to handle event on changes to registry? : Long running EventWaitHandle?

I have a Windows service that constantly runs and has a config class that gets loaded from the registry. I have a separate "Settings" application that sets these registry files.

What I need is a way to let my service know that the settings have changed, and to reload the config class.

My first thought was an EventWaitHandle that the "Settings" application could Set() once the user saves the settings. My service would start a separate thread in the OnStart() that has nothing but

while(true)
{
    myWaitEventHandler.WaitOne();
    ReloadConfig();
}

Is this a good solution? Is it bad to have an开发者_高级运维 EventWaitHandle "waiting" 24/7?


In case anybody is wondering, I've had this running for a couple days now, and haven't noticed any negative effects.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜