ThreadLocal utils
package arc.util.async;
import arc.*;
+import arc.func.*;
import arc.util.*;
import java.util.concurrent.*;
@@ -10,6 +11,15 @@ import java.util.concurrent.*;
*/
public class Threads{
+ public static <T> ThreadLocal<T> local(Prov<T> prov){
+ return new ThreadLocal<T>(){
+ @Override
+ protected T initialValue(){
+ return prov.get();
+ }
+ };
+ }
+
public static <T> T await(Future<T> future){
try{
return future.get();
