-
• #2
JavaScript is single-threaded. Busy waiting
while (getTime() < t) ..
blocks the execution of thesetInterval
callbacks - and other possible events.The segmentation fault is not nice. But the program above is not a useful JavaScript program.
-
• #3
I guess you're compiling on 32 bit Linux?
There's a problem when you try and call functions that contain a 32 bit value and then a float then another 32 bit value (like setInterval) on 32 bit x86 systems - it's due to the way they get called in
jsnative.c
.While you could fix setInterval, many other things would be broken too.
Sadly there's been no real reason to fix
jsnative.c
, as it works on ARM, Xtensa, and x86-64 where most people will be doing their builds. -
• #4
Thanks will discontinue 32 bit linux work
-
• #5
Good customer ! ;-)
Downloaded the latest github zip v88 and compiled as LINUX on Ubuntu 16.04 (32bit) and Raspberry PI.
Both compiled successfully.
Linux doing ./espruino gives sanity check int-float-int error.
Linux running simple script
Linux gives segmentation fault after sanity check error.
The problem also is on earlier version v87 where I managed to compile in DEBUG mode for Ubuntu. My limited checks indicates that the jswrap_interactive around line 453 (v87) is looking for an array which dos not exist. Hence the segmentation fault.
Running ./espruino on raspberry no sanity check problem.
The above program however loops on the while printing every second but the setIntervals never appear. Changing t1 and t5 to 1 and 5 makes no difference.
It appears that the main loop never lets the Interval code get a look in.