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

18
LINES

< > TinyBrain | #1010387 - Utilize All Cores

JavaX source code (desktop) [tags: use-pretranspiled] - run with: x30.jar - homepage

Libraryless. Click here for Pure Java version (1164L/8K).

!7

static new L<Var<Long>> vars;

p {
  int n = numberOfCores();
  print("Utilizing " + n(n, "core") + "!");
  repeat n {
    final new Var<Long> v;
    vars.add(v);
    thread {
      long n = 0;
      while (licensed()) v.set(++n);
    }
  }
  print("RUNNING :o)");
  thread { repeat with sleep 1 { print(vars); } }
}

download  show line numbers  debug dex   

Travelled to 2 computer(s): cfunsshuasjs, tvejysmllsmz

No comments. add comment

Snippet ID: #1010387
Snippet name: Utilize All Cores
Eternal ID of this version: #1010387/6
Text MD5: 05fde25484a6feb30015c1126f7129db
Transpilation MD5: da552ffc615edd0cb63cf899e35c9235
Author: stefan
Category: javax /
Type: JavaX source code (desktop)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-09-14 02:18:23
Source code size: 337 bytes / 18 lines
Pitched / IR pitched: No / No
Views / Downloads: 20 / 53
Version history: 5 change(s)
Referenced in: [show]