Commit d438fcdc authored by Niels Möller's avatar Niels Möller
Browse files

Invoke gc.

Rev: src/gc.h:1.2
Rev: src/io.c:1.30
parent c25c3742
......@@ -29,8 +29,10 @@
#include "lsh_types.h"
void gc_register(struct lsh_object *o);
int gc(struct lsh_object *root);
int gc_maybe(struct lsh_object *root, int busy);
void gc_kill(struct lsh_object *o);
void gc(struct lsh_object *root);
void gc_maybe(struct lsh_object *root, int busy);
#if 0
void gc_mark(struct lsh_object *o);
......
......@@ -46,12 +46,18 @@
#include "write_buffer.h"
#include "xalloc.h"
/* If there's nothing to do for this amount of time (ms), do
* spontaneous gc. */
#define IDLE_TIME 100
int io_iter(struct io_backend *b)
{
unsigned long nfds; /* FIXME: Should be nfds_t if that type is defined */
struct pollfd *fds;
int timeout;
/* FIXME: Callouts not implemented */
/* int timeout; */
int res;
nfds = 0;
......@@ -105,9 +111,6 @@ int io_iter(struct io_backend *b)
*
* NOTE: There might be some callouts left, but we won't wait for them. */
return 0;
/* FIXME: Callouts not implemented */
timeout = -1;
fds = alloca(sizeof(struct pollfd) * nfds);
......@@ -142,8 +145,14 @@ int io_iter(struct io_backend *b)
}
}
res = poll(fds, nfds, timeout);
res = poll(fds, nfds, IDLE_TIME);
if (!res)
{
gc_maybe(&b->super, 0);
res = poll(fds, nfds, -1);
}
if (!res)
{
/* Callouts are not implemented */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment