public static Exception Retrieve() { Exception e = null; if (numExceptionsPending > 0) { if (pendingException != null) { e = pendingException; pendingException = null; lock(typeof(BulletDynamicsPINVOKE)) { numExceptionsPending--; } } } return e; }