Changeset 14679
- Timestamp:
- 04/17/14 11:29:33 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/abcl/src/org/armedbear/lisp/LispThread.java
r14632 r14679 1265 1265 + "SECONDS may be specified as a fraction of a second, with intervals\n" 1266 1266 + "less than or equal to a nanosecond resulting in a yield of execution\n" 1267 + "to other waiting threads rather than an actual sleep.") 1267 + "to other waiting threads rather than an actual sleep.\n" 1268 + "A zero value of SECONDS *may* result in the JVM sleeping indefinitely,\n" 1269 + "depending on the implementation.") 1268 1270 private static final Primitive SLEEP = new Primitive("sleep", PACKAGE_CL, true) 1269 1271 { … … 1273 1275 long millis = sleepMillisPart(arg); 1274 1276 int nanos = sleepNanosPart(arg); 1277 boolean zeroArgP = arg.ZEROP() != NIL; 1275 1278 1276 1279 try { 1277 1280 if (millis == 0 && nanos == 0) { 1278 Thread.yield(); 1281 if (zeroArgP) { 1282 Thread.sleep(0, 0); 1283 } else { 1284 Thread.sleep(0, 1); 1285 } 1279 1286 } else { 1280 1287 Thread.sleep(millis, nanos); … … 1441 1448 + "Optionally unblock execution after TIMEOUT seconds. A TIMEOUT of zero\n" 1442 1449 + "means to wait indefinitely.\n" 1450 + "A non-zero TIMEOUT of less than a nanosecond is interpolated as a nanosecond wait." 1443 1451 + "\n" 1444 1452 + "See the documentation of java.lang.Object.wait() for further\n" … … 1468 1476 1469 1477 { 1478 long millis = sleepMillisPart(timeout); 1479 int nanos = sleepNanosPart(timeout); 1480 boolean zeroArgP = timeout.ZEROP() != NIL; 1481 1470 1482 try { 1471 object.lockableInstance().wait(sleepMillisPart(timeout), 1472 sleepNanosPart(timeout)); 1483 if (millis == 0 && nanos == 0) { 1484 if (zeroArgP) { 1485 object.lockableInstance().wait(0, 0); 1486 } else { 1487 object.lockableInstance().wait(0, 1); 1488 } 1489 } else { 1490 object.lockableInstance().wait(millis, nanos); 1491 } 1473 1492 } 1474 1493 catch (InterruptedException e) {
Note: See TracChangeset
for help on using the changeset viewer.