mirror of
https://github.com/Interlisp/maiko.git
synced 2026-03-15 14:27:19 +00:00
Compare commits
1 Commits
maiko-2404
...
testing123
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
439d92adbd |
@@ -191,4 +191,6 @@
|
||||
#define user_subr_DUMMY 012
|
||||
#define user_subr_SAMPLE_USER_SUBR 00
|
||||
|
||||
/* Experimental yield */
|
||||
#define sb_YIELD 0322
|
||||
#endif
|
||||
|
||||
15
src/subr.c
15
src/subr.c
@@ -29,6 +29,7 @@
|
||||
/***********************************************************/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
#include "lispemul.h"
|
||||
#include "address.h"
|
||||
#include "adr68k.h"
|
||||
@@ -779,6 +780,20 @@ void OP_subrcall(int subr_no, int argnum) {
|
||||
break;
|
||||
}
|
||||
#endif /* LPSOLVE */
|
||||
case sb_YIELD: {
|
||||
struct timespec rqts = {0, 833333};
|
||||
unsigned sleepnanos;
|
||||
POP_SUBR_ARGS;
|
||||
N_GETNUMBER(args[0], sleepnanos, ret_nil);
|
||||
if (sleepnanos > 999999999) {
|
||||
TopOfStack = NIL;
|
||||
break;
|
||||
}
|
||||
rqts.tv_nsec = sleepnanos;
|
||||
nanosleep(&rqts, NULL);
|
||||
TopOfStack = ATOM_T;
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
char errtext[200];
|
||||
sprintf(errtext, "OP_subrcall: Invalid alpha byte 0%o", ((*(PC + 1)) & 0xff));
|
||||
|
||||
Reference in New Issue
Block a user