Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

29
LINES

< > BotCompany Repo | #1031571 // Test WeakRefVMBusListener (OK, removes them on or before GC)

JavaX source code (Dynamic Module) [tags: use-pretranspiled] - run with: Stefan's OS

Uses 1113K of libraries. Click here for Pure Java version (2734L/14K).

!7

set flag WeakRefVMBusListener_debug.

cprint2 TestWeakRefVMBusListener {
  start-thread {
    S msg = "yoyoyo";
    
    repeat 3 {
      vmBus_onMessage_weakRef(msg, arg -> enter {
        print("Got arg: " + arg);
      });
    }
    
    int i = 0;
    repeat 10 {
      vmBus_send(msg, print(++i));
      sleepSeconds(1);
    }
    
    print("GC");
    gc();
    
    repeat 10 {
      vmBus_send(msg, print(++i));
      sleepSeconds(1);
    }
  }
}

download  show line numbers  debug dex  old transpilations   

Travelled to 4 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, vouqrxazstgt

No comments. add comment

Snippet ID: #1031571
Snippet name: Test WeakRefVMBusListener (OK, removes them on or before GC)
Eternal ID of this version: #1031571/3
Text MD5: ca56da919f7b1c1d1c3ef70b086dc8fa
Transpilation MD5: 0e0cf0b3b78da35bc8f59ec936a264a8
Author: stefan
Category: javax
Type: JavaX source code (Dynamic Module)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-06-22 04:00:18
Source code size: 486 bytes / 29 lines
Pitched / IR pitched: No / No
Views / Downloads: 89 / 153
Version history: 2 change(s)
Referenced in: [show references]