
Just think of "unsafe" in relation to "unsafeIndex" or something. It's faster, but you have to be sure the index is in bounds. Yes, but the whole reason to use "unsafe" is to get higher performance at the cost of safety. If the result of calling an "unsafe" foreign function is that you *lose* performance because the other threads have to be halted first, then this seems to defeat the whole point of marking a call as "unsafe" in the first place. That's why the function has to return soon and shouldn't do a lot of work. But again, then what is the point of marking it "unsafe" if it means
On 08/03/10 15:33, Evan Laforge wrote: that you have to pay a hefty cost of waiting for all the other threads to halt? Is the cost of halting all of the other threads really less than the cost of setting up for a "safe" call? Maybe it is, and that is what I am missing here. If it is not, though, then it seems to me that marking a call as "unsafe" will *never* gain you performance in a multi-threaded environment, so that there is never any point in using it in such an environment. (Though, of course, it could gain you performance in a single-threaded environment.) Cheers, Greg