pass to background thread

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

hey all,

i have a shared sub called WriteToErrorLog(msg as String) for obvious
purposes. How do i send that to a background thread? i'm stuck on the part
where thread.start executes a subroutine that doesn't accept parms (or can
it?) how do i get the message parm into the background sub?

2nd question: is this worth the trouble?

thanks,
ari
 
Ari,

If you use a backgroundthread, than you should in my opinion forever think
that it is meant to create a result to a foregroundthread.

All other purposes of threading let mostly to no results. In those cases
will services with their own thread work better.

However mostly is using threads not worth the trouble. (Exept as you are
sure that the background processes are acting really assynchroon).

Just my thought,

Cor
 
ari said:
hey all,

i have a shared sub called WriteToErrorLog(msg as String) for obvious
purposes. How do i send that to a background thread? i'm stuck on the part
where thread.start executes a subroutine that doesn't accept parms (or can
it?) how do i get the message parm into the background sub?

There's already a lot of information out there on getting threads to
pick up parameters. Just google for it.
2nd question: is this worth the trouble?

No. I see no benefit in a background thread processing log messages.
It would probably wind up being slower anyway. How much slower depends
on how you implemented it. But that's not the worst of it. Threading
just complicates the process of getting the error information to a log.
The last thing you want to happen after an error occurs is losing that
information because of another error in the logging code.
 
thanks very much for the feedback.

Brian Gideon said:
There's already a lot of information out there on getting threads to
pick up parameters. Just google for it.


No. I see no benefit in a background thread processing log messages.
It would probably wind up being slower anyway. How much slower depends
on how you implemented it. But that's not the worst of it. Threading
just complicates the process of getting the error information to a log.
The last thing you want to happen after an error occurs is losing that
information because of another error in the logging code.
 

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

Back
Top