diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1999-11-10 13:37:50 -0200 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1999-11-10 13:37:50 -0200 |
| commit | 53fb65d39451f9245d8ed555f941829520ee6f24 (patch) | |
| tree | 1bf6d58df6213d647270377b1bd231ef4cbfdd8c /lref.h | |
| parent | a7fa7bafc808103cbb8e27a3c80168617bac8a4f (diff) | |
| download | lua-53fb65d39451f9245d8ed555f941829520ee6f24.tar.gz lua-53fb65d39451f9245d8ed555f941829520ee6f24.tar.bz2 lua-53fb65d39451f9245d8ed555f941829520ee6f24.zip | |
better implementation of `lua_ref' (much better...)
Diffstat (limited to 'lref.h')
| -rw-r--r-- | lref.h | 15 |
1 files changed, 14 insertions, 1 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: $ | 2 | ** $Id: lref.h,v 1.1 1999/10/04 17:50:24 roberto Exp roberto $ |
| 3 | ** REF mechanism | 3 | ** REF mechanism |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -9,6 +9,19 @@ | |||
| 9 | 9 | ||
| 10 | #include "lobject.h" | 10 | #include "lobject.h" |
| 11 | 11 | ||
| 12 | |||
| 13 | #define NONEXT -1 /* to end the free list */ | ||
| 14 | #define HOLD -2 | ||
| 15 | #define COLLECTED -3 | ||
| 16 | #define LOCK -4 | ||
| 17 | |||
| 18 | |||
| 19 | struct ref { | ||
| 20 | TObject o; | ||
| 21 | int st; /* can be LOCK, HOLD, COLLECTED, or next (for free list) */ | ||
| 22 | }; | ||
| 23 | |||
| 24 | |||
| 12 | int luaR_ref (const TObject *o, int lock); | 25 | int luaR_ref (const TObject *o, int lock); |
| 13 | const TObject *luaR_getref (int ref); | 26 | const TObject *luaR_getref (int ref); |
| 14 | void luaR_invalidaterefs (void); | 27 | void luaR_invalidaterefs (void); |
