diff options
| author | Keith Randall <khr@golang.org> | 2014-08-28 13:23:10 -0700 |
|---|---|---|
| committer | Keith Randall <khr@golang.org> | 2014-08-28 13:23:10 -0700 |
| commit | c46bcd4d13492d3588638ea3ea4c752166709044 (patch) | |
| tree | 0ba3a23a9483c1c666cea054c45276a7538fb382 /src/pkg/runtime/malloc.h | |
| parent | e66ff2b9080669373704914191abf2ee5f65eb75 (diff) | |
| download | go-c46bcd4d13492d3588638ea3ea4c752166709044.tar.xz | |
runtime: move finalizer thread to Go.
LGTM=dvyukov
R=golang-codereviews, dvyukov, khr
CC=golang-codereviews
https://golang.org/cl/124630043
Diffstat (limited to 'src/pkg/runtime/malloc.h')
| -rw-r--r-- | src/pkg/runtime/malloc.h | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/pkg/runtime/malloc.h b/src/pkg/runtime/malloc.h index 0d7cd475d8..19ea846dd1 100644 --- a/src/pkg/runtime/malloc.h +++ b/src/pkg/runtime/malloc.h @@ -551,9 +551,32 @@ void runtime·gchelper(void); void runtime·createfing(void); G* runtime·wakefing(void); void runtime·getgcmask(byte*, Type*, byte**, uintptr*); + +typedef struct Finalizer Finalizer; +struct Finalizer +{ + FuncVal *fn; // function to call + void *arg; // ptr to object + uintptr nret; // bytes of return values from fn + Type *fint; // type of first argument of fn + PtrType *ot; // type of ptr to object +}; + +typedef struct FinBlock FinBlock; +struct FinBlock +{ + FinBlock *alllink; + FinBlock *next; + int32 cnt; + int32 cap; + Finalizer fin[1]; +}; +extern Mutex runtime·finlock; // protects the following variables extern G* runtime·fing; extern bool runtime·fingwait; extern bool runtime·fingwake; +extern FinBlock *runtime·finq; // list of finalizers that are to be executed +extern FinBlock *runtime·finc; // cache of free blocks void runtime·setprofilebucket(void *p, Bucket *b); |
