[libinline-java-perl] 241/398: initial
Jonas Smedegaard
dr at jones.dk
Thu Feb 26 11:43:09 UTC 2015
This is an automated email from the git hooks/post-receive script.
js pushed a commit to tag 0.55
in repository libinline-java-perl.
commit c887728b16d1b2aab6c829e4ee5088555855ed39
Author: patrick_leb <>
Date: Sun Nov 2 20:09:10 2003 +0000
initial
---
Java/sources/InlineJavaThreadMonitor.java | 61 +++++++++++++++++++++++++++++++
1 file changed, 61 insertions(+)
diff --git a/Java/sources/InlineJavaThreadMonitor.java b/Java/sources/InlineJavaThreadMonitor.java
new file mode 100644
index 0000000..9992994
--- /dev/null
+++ b/Java/sources/InlineJavaThreadMonitor.java
@@ -0,0 +1,61 @@
+package org.perl.inline.java ;
+
+import java.util.* ;
+
+
+class InlineJavaThreadMonitor {
+ static ThreadGroup root = null ;
+ static {
+ ThreadGroup tg = Thread.currentThread().getThreadGroup() ;
+ while (tg != null){
+ tg = tg.getParent() ;
+ }
+ root = tg ;
+ }
+
+ private Thread active_threads = null ;
+
+
+ InlineJavaThreadMonitor(){
+ active_threads = GetActiveThreads() ;
+ }
+
+
+ private Thread[] GetActiveThreads(){
+ int size_est = root.activeCount() * 2 ;
+ Thread list[] = new Thread[size_est] ;
+
+ int size = root.enumerate(list) ;
+ Thread ret[] = new Thread[size] ;
+ for (int i = 0 ; i < size ; i++){
+ ret[i] = list[i] ;
+ }
+
+ return ret ;
+ }
+
+
+ public Thread[] GetNewThreads(){
+ Thread current_threads[] = GetActiveThreads() ;
+ int nb_new = current_threads.length - active_threads.length ;
+ if (nb_new > 0){
+ Thread ret[] = new Thread[nb_new] ;
+ int idx = 0 ;
+ for (int i = 0 ; i < current_threads.length ; i++){
+ boolean found = false ;
+ for (int j = 0 ; j < active_threads.length ; j++){
+ if (active_threads[j] = current_threads[i]){
+ found = true ;
+ break ;
+ }
+ }
+ if (! found){
+ ret[idx] = current_threads[i] ;
+ idx++ ;
+ }
+ }
+ else{
+ return new Thread [] {} ;
+ }
+ }
+}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libinline-java-perl.git
More information about the Pkg-perl-cvs-commits
mailing list