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

30
LINES

< > BotCompany Repo | #1027695 // Runnable Threads

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

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

1  
!7
2  
3  
sclass Entry {
4  
  WeakReference<Thread> thread;
5  
  long threadID;
6  
  S threadName, stackTrace;
7  
}
8  
9  
cmodule2 RunnableThreads > DynObjectTable<Entry> {
10  
  start {
11  
    dontPersist();
12  
    //itemToMap = func(Thread t) -> Map { litorderedmap("Name" := t.getName()) };
13  
    dm_doEveryAndNow(2.0, r actualUpdate);
14  
  }
15  
  
16  
  void actualUpdate enter {
17  
    setData(map(runnableThreadsWithStackTraces(), 
18  
      (t, st) -> nu Entry(
19  
        thread := weakRef(t),
20  
        threadID := threadID(t),
21  
        threadName := t.getName(),
22  
        stackTrace := stackTraceToString(st))));
23  
  }
24  
25  
  afterVisualize {
26  
    popupMenuItem_top("Cancel thread", voidfunc(Entry e) {
27  
      cancelForeignThread(e.thread!);
28  
    });
29  
  }
30  
}

Author comment

Began life as a copy of #1016644

download  show line numbers  debug dex  old transpilations   

Travelled to 7 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv

No comments. add comment

Snippet ID: #1027695
Snippet name: Runnable Threads
Eternal ID of this version: #1027695/9
Text MD5: 720325bf9b488022bb8475c118caf9f5
Transpilation MD5: 1c7461a6465b45be8ef131f7bd27a5a7
Author: stefan
Category: javax / modules
Type: JavaX source code (Dynamic Module)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-06-25 12:54:38
Source code size: 698 bytes / 30 lines
Pitched / IR pitched: No / No
Views / Downloads: 139 / 30839
Version history: 8 change(s)
Referenced in: [show references]