Being a shared *method* or not is not relevant. You should never have any
problem with CODE itself. By design, running several threads in parallel and
saving/restoring context for those threads is a built in mechanism.
The real problem is not the CODE but rather the DATA on which this code
operates as there are no automatic mechanism to handle this so your code
will do exactly what you asked for (including using the same data for
multiple threads of execution which is sometimes what we want and sometimes
not). On the other hand we never want (and we'll never have) executable
statements in multiple threads to interfere with others *just* because they
happen at the same time (but it can because it operates on the same *data*
even if not exactly at the same time)
Try
http://en.wikipedia.org/wiki/Thread_(computer_science) and/or
http://en.wikipedia.org/wiki/Thread_safety for details.
--
Patrice
<
[email protected]> a écrit dans le message de
(e-mail address removed)...
Calling code is not a problem in itself as all code runs in its own
context
i.e. if properly done you are *really* calling GetUsers(1) for user 1 and
GetUsers(2) for user 2 giving each user a distinct response. The response
that is given by a given call won't be automagically transferred as a
reponse to the other call that is made in a different context...
The problem you could likely have is if this code uses data that are
shared
by multiple users (for example most often using a static member). If you
really saw this, you likely have some static data somewhere (either the
argument passed to GetUsers is stored in a static member, or "query" is
defined as a static string or somewhere in GetData you are using a static
dataset or whatever...)
oh, I see, so when I ONLY call a static method like a GetUSERS it will
be everithing ok, yes?
because every user runs a method in the different context
thats
great. I didnt know that
thanx.
bye bye.