Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
LSH
lsh
Commits
d438fcdc
Commit
d438fcdc
authored
Dec 02, 1998
by
Niels Möller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Invoke gc.
Rev: src/gc.h:1.2 Rev: src/io.c:1.30
parent
c25c3742
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
7 deletions
+18
-7
src/gc.h
src/gc.h
+4
-2
src/io.c
src/io.c
+14
-5
No files found.
src/gc.h
View file @
d438fcdc
...
...
@@ -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);
...
...
src/io.c
View file @
d438fcdc
...
...
@@ -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
;
...
...
@@ -106,9 +112,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
);
/* Fill out fds-array */
...
...
@@ -142,7 +145,13 @@ 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
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment