var globalArray = [];
This callback gets fired up to 100 times per second
function EventCallback(param) {
globalArray.push(param);
}
Main part of the program where I process the list of items.
What happens if the callback gets fired while in the middle of modifying the array here?
while(globalArray.length > 0)
{
ProcessListItem(globalArray.shift());
}
The issue I'm running into is that Firefox Spidermonkey javascript engine is sometimes bugging out (race condition/threading issue?) and telling me that globalArray.push is not a function or other strange errors.
What I'm trying to achieve is to have the callback add items to a list so I can process them later. Is there any better way to code this? I'm new to this so any advice is appreciated. Thanks
whileloop because JavaScript is single threaded.