File tree Expand file tree Collapse file tree 2 files changed +53
-0
lines changed
src/main/java/me/anatoliy57/chunit/functions Expand file tree Collapse file tree 2 files changed +53
-0
lines changed Original file line number Diff line number Diff line change @@ -42,6 +42,12 @@ Swaps one procedure for another (or given closure) in a saved environment
4242## Global
4343A set of functions for globals
4444
45+ ### void x_set_extend_daemon_manager():
46+ Sets extend daemon manager, that clearing globals when threads deactivated.
47+
48+ ### void x_set_auto_globals(auto):
49+ ets automatically initialize globals for new threads.
50+
4551### boolean is\_ auto\_ globals():
4652Returns whether globals for threads are automatically initialized.
4753
Original file line number Diff line number Diff line change @@ -337,6 +337,53 @@ public Boolean runAsync() {
337337 }
338338 }
339339
340+ @ api
341+ public static class x_set_extend_daemon_manager extends AbstractFunction {
342+
343+ public x_set_extend_daemon_manager () {
344+ }
345+
346+ public String getName () {
347+ return "x_set_extend_daemon_manager" ;
348+ }
349+
350+ public Integer [] numArgs () {
351+ return new Integer []{0 };
352+ }
353+
354+ public String docs () {
355+ return "void {} Sets extend daemon manager, that clearing globals when threads deactivated." ;
356+ }
357+
358+ public Class <? extends CREThrowable >[] thrown () {
359+ return new Class []{};
360+ }
361+
362+ public boolean isRestricted () {
363+ return true ;
364+ }
365+
366+ public MSVersion since () {
367+ return MSVersion .V3_3_4 ;
368+ }
369+
370+ public Mixed exec (Target t , Environment env , Mixed ... args ) throws ConfigRuntimeException {
371+ synchronized (Globals .class ) {
372+ DaemonManager daemonManager = ReflectionUtils .GetDaemonManager (env );
373+ if (!(daemonManager instanceof ExtendDaemonManager )) {
374+ ExtendDaemonManager extendManager = new ExtendDaemonManager (daemonManager , false );
375+ ReflectionUtils .SetDaemonManager (env , extendManager );
376+ }
377+ }
378+
379+ return CVoid .VOID ;
380+ }
381+
382+ public Boolean runAsync () {
383+ return null ;
384+ }
385+ }
386+
340387 @ api
341388 public static class x_set_auto_globals extends AbstractFunction {
342389
You can’t perform that action at this time.
0 commit comments