Fondamentalmente, ho alcune classi che chiamano un vuoto statico che fornisce argomenti (used in an ASP website)
.I metodi statici con argomenti out thread sono sicuri?
Da quanto ho capito perché il vuoto ha il proprio stack, è thread-safe, tuttavia non sono del tutto sicuro che questo sia vero quando vengono utilizzati gli outs. Qualcuno può chiarire il problema. Grazie!
namespace ThreadTest
{
class Program
{
static void Main(string[] args)
{
int helloWorldint = 0;
bool helloWorldbool = false;
int helloWorldintOut = 0;
bool helloWorldboolOut = false;
setHelloWorlds(helloWorldint, helloWorldbool, out helloWorldintOut, out helloWorldboolOut);
Console.WriteLine(helloWorldintOut);
Console.WriteLine(helloWorldboolOut);
}
public static void setHelloWorlds(int helloWorldint, bool helloWorldbool, out int helloWorldintOut, out bool helloWorldboolOut)
{
helloWorldintOut = helloWorldint + 1;
helloWorldboolOut = true;
}
}
}
Dove entrano in gioco i fili? – Markus
@Markus ASP Sito web stesso pool di applicazioni – user6445891
Perché non restituire gli oggetti anziché utilizzare gli outs? –