Mercurial Hosting > luan
comparison src/luan/modules/http/tools/Luan_threads.luan @ 1355:b84f60ebe196
minor fixes
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Wed, 17 Apr 2019 01:32:52 -0600 |
parents | 8d95711f6615 |
children | ef1620aa99cb |
comparison
equal
deleted
inserted
replaced
1354:2449ca95dc1e | 1355:b84f60ebe196 |
---|---|
2 local error = Luan.error | 2 local error = Luan.error |
3 local Table = require "luan:Table.luan" | 3 local Table = require "luan:Table.luan" |
4 local java_to_table_shallow = Table.java_to_table_shallow or error() | 4 local java_to_table_shallow = Table.java_to_table_shallow or error() |
5 local Io = require "luan:Io.luan" | 5 local Io = require "luan:Io.luan" |
6 local Time = require "luan:Time.luan" | 6 local Time = require "luan:Time.luan" |
7 local Table = require "luan:Table.luan" | |
8 local to_table = Table.java_to_table_shallow or error() | |
7 local Http = require "luan:http/Http.luan" | 9 local Http = require "luan:http/Http.luan" |
8 require "java" | 10 require "java" |
9 local Thread = require "java:java.lang.Thread" | 11 local Thread = require "java:java.lang.Thread" |
10 local LuanException = require "java:luan.LuanException" | 12 local LuanException = require "java:luan.LuanException" |
11 | 13 |
15 function Luan_threads.respond() | 17 function Luan_threads.respond() |
16 Io.stdout = Http.response.text_writer() | 18 Io.stdout = Http.response.text_writer() |
17 | 19 |
18 local threads = Thread.getAllStackTraces() | 20 local threads = Thread.getAllStackTraces() |
19 local threads = {} | 21 local threads = {} |
20 for thread, trace in Luan.pairs(Thread.getAllStackTraces()) do | 22 for thread, trace in Luan.pairs(to_table(Thread.getAllStackTraces())) do |
21 threads[#threads+1] = { | 23 threads[#threads+1] = { |
22 trace = trace | 24 trace = trace |
23 string = thread.toString() | 25 string = thread.toString() |
24 state = thread.getState() | 26 state = thread.getState() |
25 } | 27 } |