diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2008-08-01 14:01:16 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2008-08-01 14:01:16 -0300 |
| commit | e23da9edee5034dd62d09f44cd2e9a8a3e32dedd (patch) | |
| tree | f3d1493ca1d225028d30dfd0f912f59b1f004473 | |
| parent | 4db2cddeee6889a3e7ed9a17a31049d45a6fe22f (diff) | |
| download | lua-e23da9edee5034dd62d09f44cd2e9a8a3e32dedd.tar.gz lua-e23da9edee5034dd62d09f44cd2e9a8a3e32dedd.tar.bz2 lua-e23da9edee5034dd62d09f44cd2e9a8a3e32dedd.zip | |
GC step does not unblock collector (when it is blocked by "stop")
| -rw-r--r-- | lapi.c | 5 |
1 files changed, 4 insertions, 1 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lapi.c,v 2.66 2008/02/19 18:55:09 roberto Exp roberto $ | 2 | ** $Id: lapi.c,v 2.67 2008/07/04 18:27:11 roberto Exp roberto $ |
| 3 | ** Lua API | 3 | ** Lua API |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -906,6 +906,7 @@ LUA_API int lua_gc (lua_State *L, int what, int data) { | |||
| 906 | break; | 906 | break; |
| 907 | } | 907 | } |
| 908 | case LUA_GCSTEP: { | 908 | case LUA_GCSTEP: { |
| 909 | lu_mem oldts = g->GCthreshold; | ||
| 909 | lu_mem a = (cast(lu_mem, data) << 10); | 910 | lu_mem a = (cast(lu_mem, data) << 10); |
| 910 | g->GCthreshold = (a <= g->totalbytes) ? g->totalbytes - a : 0; | 911 | g->GCthreshold = (a <= g->totalbytes) ? g->totalbytes - a : 0; |
| 911 | while (g->GCthreshold <= g->totalbytes) { | 912 | while (g->GCthreshold <= g->totalbytes) { |
| @@ -915,6 +916,8 @@ LUA_API int lua_gc (lua_State *L, int what, int data) { | |||
| 915 | break; | 916 | break; |
| 916 | } | 917 | } |
| 917 | } | 918 | } |
| 919 | if (oldts == MAX_LUMEM) /* collector was stopped? */ | ||
| 920 | g->GCthreshold = oldts; /* keep it that way */ | ||
| 918 | break; | 921 | break; |
| 919 | } | 922 | } |
| 920 | case LUA_GCSETPAUSE: { | 923 | case LUA_GCSETPAUSE: { |
