mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-02 04:40:29 +02:00
* async.h: kill the scm_async_t struct. having a heap cell
pretending to be a C struct is not helthy, and is not needed here anyway, as asyncs happily fit in one heap cell. * async.c: reflect the fact that asyncs are now represented by single heap cell each.
This commit is contained in:
parent
873c35ee82
commit
843e4e9d17
3 changed files with 49 additions and 51 deletions
|
@ -1,3 +1,12 @@
|
|||
2000-04-04 Michael Livshin <mlivshin@bigfoot.com>
|
||||
|
||||
* async.h: kill the scm_async_t struct. having a heap cell
|
||||
pretending to be a C struct is not helthy, and is not needed here
|
||||
anyway, as asyncs happily fit in one heap cell.
|
||||
|
||||
* async.c: reflect the fact that asyncs are now represented by
|
||||
single heap cell each.
|
||||
|
||||
2000-04-04 Gary Houston <ghouston@arglist.com>
|
||||
|
||||
* error.c (scm_syserror): save errno before doing anything else,
|
||||
|
|
|
@ -122,11 +122,8 @@ scm_asyncs_pending ()
|
|||
pos = scm_asyncs;
|
||||
while (pos != SCM_EOL)
|
||||
{
|
||||
SCM a;
|
||||
struct scm_async * it;
|
||||
a = SCM_CAR (pos);
|
||||
it = SCM_ASYNC (a);
|
||||
if (it->got_it)
|
||||
SCM a = SCM_CAR (pos);
|
||||
if (SCM_ASYNC_GOT_IT (a))
|
||||
return 1;
|
||||
pos = SCM_CDR (pos);
|
||||
}
|
||||
|
@ -286,9 +283,7 @@ scm_async_click ()
|
|||
static SCM
|
||||
mark_async (SCM obj)
|
||||
{
|
||||
struct scm_async * it;
|
||||
it = SCM_ASYNC (obj);
|
||||
return it->thunk;
|
||||
return SCM_ASYNC_THUNK (obj);
|
||||
}
|
||||
|
||||
|
||||
|
@ -298,7 +293,7 @@ SCM_DEFINE (scm_async, "async", 1, 0, 0,
|
|||
"")
|
||||
#define FUNC_NAME s_scm_async
|
||||
{
|
||||
SCM_RETURN_NEWSMOB2 (scm_tc16_async, 0, SCM_UNPACK (thunk));
|
||||
SCM_RETURN_NEWSMOB (scm_tc16_async, SCM_UNPACK (thunk));
|
||||
}
|
||||
#undef FUNC_NAME
|
||||
|
||||
|
@ -324,12 +319,11 @@ SCM_DEFINE (scm_async_mark, "async-mark", 1, 0, 0,
|
|||
"")
|
||||
#define FUNC_NAME s_scm_async_mark
|
||||
{
|
||||
struct scm_async * it;
|
||||
SCM_VALIDATE_ASYNC_COPY (1,a,it);
|
||||
SCM_VALIDATE_ASYNC (1,a);
|
||||
#ifdef GUILE_OLD_ASYNC_CLICK
|
||||
it->got_it = 1;
|
||||
SCM_SET_ASYNC_GOT_IT (a, 1);
|
||||
#else
|
||||
scm_asyncs_pending_p = it->got_it = 1;
|
||||
SCM_SET_ASYNC_GOT_IT (a, scm_asyncs_pending_p = 1);
|
||||
#endif
|
||||
return SCM_UNSPECIFIED;
|
||||
}
|
||||
|
@ -341,15 +335,14 @@ SCM_DEFINE (scm_system_async_mark, "system-async-mark", 1, 0, 0,
|
|||
"")
|
||||
#define FUNC_NAME s_scm_system_async_mark
|
||||
{
|
||||
struct scm_async *it;
|
||||
SCM_VALIDATE_ASYNC_COPY (1, a, it);
|
||||
SCM_VALIDATE_ASYNC (1, a);
|
||||
SCM_REDEFER_INTS;
|
||||
#ifdef GUILE_OLD_ASYNC_CLICK
|
||||
it->got_it = 1;
|
||||
SCM_SET_ASYNC_GOT_IT (a, 1);
|
||||
scm_async_rate = 1 + scm_async_rate - scm_async_clock;
|
||||
scm_async_clock = 1;
|
||||
#else
|
||||
scm_asyncs_pending_p = it->got_it = 1;
|
||||
SCM_SET_ASYNC_GOT_IT (a, scm_asyncs_pending_p = 1);
|
||||
#endif
|
||||
SCM_REALLOW_INTS;
|
||||
return SCM_UNSPECIFIED;
|
||||
|
@ -371,15 +364,14 @@ SCM_DEFINE (scm_run_asyncs, "run-asyncs", 1, 0, 0,
|
|||
while (! SCM_NULLP (list_of_a))
|
||||
{
|
||||
SCM a;
|
||||
struct scm_async * it;
|
||||
SCM_VALIDATE_CONS (1, list_of_a);
|
||||
a = SCM_CAR (list_of_a);
|
||||
SCM_VALIDATE_ASYNC_COPY (SCM_ARG1,a,it);
|
||||
SCM_VALIDATE_ASYNC (SCM_ARG1,a);
|
||||
scm_mask_ints = 1;
|
||||
if (it->got_it)
|
||||
if (SCM_ASYNC_GOT_IT (a))
|
||||
{
|
||||
it->got_it = 0;
|
||||
scm_apply (it->thunk, SCM_EOL, SCM_EOL);
|
||||
SCM_SET_ASYNC_GOT_IT (a, 0);
|
||||
scm_apply (SCM_ASYNC_THUNK (a), SCM_EOL, SCM_EOL);
|
||||
}
|
||||
scm_mask_ints = 0;
|
||||
list_of_a = SCM_CDR (list_of_a);
|
||||
|
|
|
@ -52,13 +52,10 @@
|
|||
|
||||
|
||||
#define SCM_ASYNCP(X) (SCM_NIMP(X) && (scm_tc16_async == SCM_GCTYP16 (X)))
|
||||
#define SCM_ASYNC(X) ((struct scm_async *) &SCM_CDR (X))
|
||||
|
||||
struct scm_async
|
||||
{
|
||||
scm_bits_t got_it; /* needs to be delivered? */
|
||||
SCM thunk; /* the handler. */
|
||||
};
|
||||
#define SCM_ASYNC_GOT_IT(X) (SCM_CELL_WORD_0 (X) >> 16)
|
||||
#define SCM_SET_ASYNC_GOT_IT(X, V) (SCM_SET_CELL_WORD_0 (X, (SCM_CELL_WORD_0 (X) & ((1 << 16) - 1)) | ((V) << 16)))
|
||||
#define SCM_ASYNC_THUNK(X) SCM_CELL_OBJECT_1 (X)
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue