Thread-local variables of any type can be defined in your D program, including associative arrays.
Sie können in einem D-Programm thread-lokale Variablen jedes beliebigen Typs, einschließlich assoziativer Vektoren, definieren.
As with associative array elements, underlying storage is not allocated for a thread-local variable until a non-zero value is assigned to it.
Ebenso wie bei den Elementen assoziativer Vektoren erfolgt die Speicherreservierung für eine thread-lokale Variable erst, wenn dieser ein Wert ungleich Null zugewiesen wird.
The following example shows how to use thread-local variables.
Das folgende Beispiel verdeutlicht die Verwendung von thread-lokalen Variablen.
Always assign zero to thread-local variables that are no longer in use.
Weisen Sie thread-lokalen Variablen, die nicht mehr benötigt werden, immer den Wert Null zu.
Thread-local variables are inaccessible to probes from the profile provider.
Thread-lokale Variablen sind für Prüfpunkte aus dem Provider profile nicht erreichbar.
Using the special identifier self to reference a thread-local variable with such a probe will produce no output.
Die Verwendung des speziellen Bezeichners self mit einem solchen Prüfpunkt zur Referenzierung einer thread-lokalen Variable generiert keine Ausgabe.
The following example using thread-local variables is preferable
Das folgende Beispiel mit thread-lokalen Variablen ist dem obigen vorzuziehen
You can think of a thread-local variable as an associative array that is implicitly indexed by a tuple that describes the thread's identity in the system.
Eine thread-lokale Variable kann man sich als einen assoziativen Vektor vorstellen, der durch ein die Identität des Threads im System beschreibendes Tupel implizit indiziert wird.
You cannot use a thread-local variable in this case because a thread might be enqueued by another thread.
In diesem Fall kann keine thread-lokale Variable verwendet werden, da ein Thread auch durch einen anderen Thread in die Warteschlange gestellt werden kann.
All of these variables are scalar global variables; no thread-local or clause-local variables or built-in associative arrays are currently defined by D.
Dabei handelt es sich in allen Fällen um skalare, globale Variablen. Derzeit sind in D weder thread-lokale oder klausel-lokale Variablen noch integrierte assoziative Vektoren definiert.
Typically, you assign the result of speculation to a thread-local variable and then use that variable as a subsequent predicate to other probes as well as an argument to speculate.
Im Normalfall weisen wir das Ergebnis einer speculation einer thread-lokalen Variable zu und setzen diese Variable dann als nachfolgendes Prädikat für andere Prüfpunkte sowie als Argument für speculate ein.
rtime.d uses a thread-local variable named t to capture a timestamp on entry to read 2 by any thread.
In rtime.d wird mit der thread-lokalen Variable t beim Eintritt in read 2 durch einen beliebigen Thread eine Zeitmarke erfasst.
Similar to global variables, thread-local variables are created automatically on their first assignment and assume the type used on the right-hand side of the first assignment statement (in this example, int).
Ebenso wie globale Variablen werden auch thread-lokale Variablen bei ihrer ersten Zuweisung automatisch erzeugt und nehmen den auf der rechten Seite der ersten Zuweisungsanweisung verwendeten Typ an (in diesem Beispiel int).
Contenu potentiellement sensible ou inapproprié
Les exemples vous aident à traduire le mot ou l’expression cherchés dans des contextes variés. Ils ne sont ni sélectionnés ni validés par nous et peuvent contenir des mots ou des idées inappropriés. Signalez des exemples à modifier ou à retirer. Les traductions potentiellement sensibles, inappropriées ou familières sont généralement marquées de rouge ou d’orange.