making my windows app thread safe

  • Thread starter Thread starter David C
  • Start date Start date
D

David C

I will be having my windows application run on the network so as to make
deployment and maintenance easy.

My concern is thread safety. I guess static objects aren't threadsafe
for sure, but then again, is anything thread safe?

Is there a easy way to address this? I am guessing that I just have
every user operate in a distinct thread.
 
What kind of windows app?
Is this a windows forms app? Do you mean running from a file share on the
network? Running through terminal services?

In either of those cases, thread safety isn't any more of an issue as it is
running the app normally.

Cheers,

Hector
 
Yes it is a windows forms app written in C#.

It will run from a file share on the network. How could thread safety
not be a problem? Even static objects?

Will it be just like running it off the local harddrive since the
process is in local memory?
 
I can't see any threading problems as each instance will run on a separate
machine. Sharing problems, though, may appear if your app accesses common
files, specialy for write access. The EXE itself I believe won't give you
trouble.
 
Yes it is a windows forms app written in C#.

It will run from a file share on the network. How could thread safety
not be a problem? Even static objects?

Will it be just like running it off the local harddrive since the
process is in local memory?

It's not a case of where it will be running from, it's a case of which
process the different threads will be in - and if each copy is running on a
different user's computer (regardless of where it's loaded from), it'll be
in a different thread. Even if one user loaded the program twice, it would
be running in two different processes.

I hope you're not relying on different users being able to use the same
"static objects" - you won't get that behaviour at all.

See http://www.pobox.com/~skeet/csharp/threads for a relatively gentle
introduction to threading.

Jon
 
Back
Top