Re: Write log file using Thread
- From: "Simon Hart [MVP]" <srhartone@xxxxxxxxx>
- Date: Tue, 19 May 2009 22:50:36 +0100
It sounds like you are talking about having an asynchronous process for logging stuff so that you can return control to the user instead of blocking the UI thread. This might improve perceived performance. But no doubt all you are doing is writing 1 line or so at a time. The overhead of creating a thread probably would not be worth it. As this creation is expensive not to mention you will have to sync the file which causes blocking - and always use the threadpool.
On a side note to good app design:
If you are logging exceptions, have you considered creating an exception interceptor that gets executed when a given exception occurs. There are many frameworks on the desktop that handle this but only one I know about on the CF and that is PostSharp. This is often refered to as cross cutting concerns. You could then use log4net to log data. (there is support for CF)
--
Simon Hart
Visual Developer - Device Application Development MVP
http://www.simonrhart.com
<verenadoll@xxxxxxxxx> wrote in message news:c33a5e7d-da84-4363-b0b0-9ccfe199d89f@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hello Ginny,
thanks for your answer.
Actually my programm execute a function and at the end of the function
i write the duration time to a log file. After that next function was
executed and so on. every time the log file was written, my programm
has to "wait". So i thought using one thread and a queue would get
better performace, because writing the logfile, can be done in
backgroud.
i don´t understand, why this wouldn´t get better performance.
Regards, Verena Doll
.
- References:
- Write log file using Thread
- From: verenadoll
- Re: Write log file using Thread
- From: Ginny Caughey MVP
- Re: Write log file using Thread
- From: verenadoll
- Write log file using Thread
- Prev by Date: Re: Missing Link for CF Application Idle Timer
- Next by Date: Re: COM object import and pointers
- Previous by thread: Re: Write log file using Thread
- Next by thread: Re: Write log file using Thread
- Index(es):
Relevant Pages
|