By default it will terminate immediatly and application will be closed. That's why you have BG and FG Threads. BG will terminate immediatly and app will be closed. FG will keep the app alive until the last FG is active except the main app thread. You should be carefull especially when working with databases and BG threads. You should explicitly wait for BG to finish using some timeout, calling Thread.Join, and if it still not finished then try to abort, and at the and abandon it. If BG is terminated just like that, finally blok will be skipped, and this is especially important when working with database. Maybe if you are doing some important operation like Rollback or Commit will not be executed.
About your question, it depends. If you work with transactions and want to insert and update all or none of them, then none of them will be commited if BG thread is stopped in the middle. If you don't work in one transaction, the one's that have passed will be in the db, the rest will not be.
|