Windows service and threads

N

NWx

Hi,

I want to develop a windows service.
It will look into a database for some records in a notification table, and
based on datetime in some field, will send an e-mail message.

This is my first service app, and also first time I want to use threads, so
I need some advices - thoughts

App will perform as follows
1. In OnStart, I read database connection, SMTP server, from app.config and
set to own variables
2. On a timer event I perform a database query, and check if there are
notifications to send
If they are, I start a new thread to each notification, and in that thread
send the e-mail message

My questions are:
1. I don't need synchronization between threads and main thread. When the
sub who send e-mail is finished, the thread is finished automatically? Or I
have to kill it somehow from my main thread when the processing the thread
did was finished?
2. Where I can find some articles about best practices writing win services
with timers?

Thank you
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top