-
Notifications
You must be signed in to change notification settings - Fork 67
Update timer #271
base: master
Are you sure you want to change the base?
Update timer #271
Conversation
jtransc-rt/src/java/util/Timer.java
Outdated
void add(TimerTask task) { | ||
// Grow backing store if necessary | ||
if (size + 1 == queue.length) | ||
queue = Arrays.copyOf(queue, 2*queue.length); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since those are not integers or other primitives, why not to use an ArrayList instead? That way you would avoid having to do this manually
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you need this already, feel free to merge, I don't see anything too strange. But we should create an issue to revisit this. Maybe converting some manual arrays into ArrayList/Heap, and in the future maybe providing a way to use native timers in targets like JS?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the license of those files?
} | ||
|
||
if (!taskFired) { // Task hasn't yet fired; wait | ||
Thread.sleep(50); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one is another target for a future optimization using synchronization primitives. I have to check the status of them right now, since the initial target of jtransc was single threaded environments probably they still need some work, so I can understand this if they are not fully working by now.
Codecov Report
@@ Coverage Diff @@
## master #271 +/- ##
=========================================
Coverage 17.89% 17.89%
Complexity 388 388
=========================================
Files 312 312
Lines 20749 20749
Branches 4495 4495
=========================================
Hits 3713 3713
Misses 16360 16360
Partials 676 676 Continue to review full report at Codecov.
|
@intrigus you right. i found text of header and insert it. |
@soywiz I am not sure but I think that we can not mix Apache 2.0 and GPL Classpath Exception. |
Im not a license expert. I think that java.util base comes from android. What i can do is to try to use either android or openjdk as base. But it will require modifications to not include lots of stuff, not being that dependant on threads for jslike targets, and to reduce interdpendency and not use if that comptible with openjdk. Also until java8 support is not completed (mostly the pending PR) it wouldnt work. |
I try fix deadlocks in my app after sync added for lime =( we can - not merge this, if i can fix i write about here. |
No description provided.