By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,344 Members | 1,142 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,344 IT Pros & Developers. It's quick & easy.

Multi-threaded app running procedures on a module...

P: n/a
Hi there... I have a simple question. I have a multi-threaded app where
different threads run procedures and functions on a single module.
Obviously, it's possible that two (or more) threads could be running
the same procedure on the module at the same time. Is this bad? If so,

This is a huge module with tons of procedures/functions on it, and I'm
thinking of converting it to a class so that a new instance can be
created by each thread, but I want to make sure it's worth it first.

Thanks for any help.

Nov 21 '05 #1
Share this Question
Share on Google+
6 Replies

P: n/a
It's not code that you have to worry about, it's data. As long as
there are no modular-level variables in your module (for example, if it
is just filled with utility methods) then you are safe.


Nov 21 '05 #2

P: n/a
Right... there are no module level variables (except for the ones that
I want to be accessible by all threads). It's just a bunch of utility
methods/functions. I was just wondering about the code aspect, since
they could be executing the same code at the same time.

Nov 21 '05 #3

P: n/a
Just make sure that you synchronize access to the module level
variables that are accessible to all threads.

Nov 21 '05 #4

P: n/a
um.... so how would I do that? :o)

Nov 21 '05 #5

P: n/a
You would need to use the SyncLock statement to lock the variable,
something like this:

SyncLock var
'Code to change the var
End SyncLock

Look up the SyncLock statement in the docs and it should have more

Nov 21 '05 #6

P: n/a
excellent... thanks man.


Nov 21 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.