Mercurial > projects > dwt-addons
diff dwtx/dwtxhelper/JThread.d @ 185:987b95661bb9
Added impl for Timer/TimerTask
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Sat, 18 Oct 2008 15:02:49 +0200 |
parents | ed80c5c2b550 |
children |
line wrap: on
line diff
--- a/dwtx/dwtxhelper/JThread.d Sat Oct 18 15:02:28 2008 +0200 +++ b/dwtx/dwtxhelper/JThread.d Sat Oct 18 15:02:49 2008 +0200 @@ -2,6 +2,7 @@ import tango.core.Thread; import dwt.dwthelper.utils; +import tango.util.log.Trace; class JThread { @@ -66,7 +67,11 @@ return (thread.priority-Thread.PRIORITY_MIN) * (MAX_PRIORITY-MIN_PRIORITY) / (Thread.PRIORITY_MAX-Thread.PRIORITY_MIN) + MIN_PRIORITY; } public void setPriority( int newPriority ) { - thread.priority( (newPriority-MIN_PRIORITY) * (Thread.PRIORITY_MAX-Thread.PRIORITY_MIN) / (MAX_PRIORITY-MIN_PRIORITY) +Thread.PRIORITY_MIN ); +// assert( MIN_PRIORITY < MAX_PRIORITY ); +// assert( Thread.PRIORITY_MIN < Thread.PRIORITY_MAX ); + auto scaledPrio = (newPriority-MIN_PRIORITY) * (Thread.PRIORITY_MAX-Thread.PRIORITY_MIN) / (MAX_PRIORITY-MIN_PRIORITY) +Thread.PRIORITY_MIN; + Trace.formatln( "JThread.setPriority: scale ({} {} {}) -> ({} {} {})", MIN_PRIORITY, newPriority, MAX_PRIORITY, Thread.PRIORITY_MIN, scaledPrio, Thread.PRIORITY_MAX); +// thread.priority( scaledPrio ); } private void internalRun(){