/usr/lib/gcc/x86_64-linux-gnu/5/include/d/rt/tlsgc.d is in libphobos-5-dev 5.5.0-12ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 | /**
*
* Copyright: Copyright Digital Mars 2011 - 2012.
* License: $(WEB www.boost.org/LICENSE_1_0.txt, Boost License 1.0).
* Authors: Martin Nowak
*/
/* Copyright Digital Mars 2011.
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE or copy at
* http://www.boost.org/LICENSE_1_0.txt)
*/
/* NOTE: This file has been patched from the original DMD distribution to
* work with the GDC compiler.
*/
module rt.tlsgc;
import core.stdc.stdlib;
static import rt.lifetime;
/**
* Per thread record to store thread associated data for garbage collection.
*/
struct Data
{
rt.lifetime.BlkInfo** blockInfoCache;
}
/**
* Initialization hook, called FROM each thread. No assumptions about
* module initialization state should be made.
*/
void* init()
{
auto data = cast(Data*).malloc(Data.sizeof);
*data = Data.init;
// do module specific initialization
data.blockInfoCache = &rt.lifetime.__blkcache_storage;
return data;
}
/**
* Finalization hook, called FOR each thread. No assumptions about
* module initialization state should be made.
*/
void destroy(void* data)
{
// do module specific finalization
.free(data);
}
alias void delegate(void* pstart, void* pend) nothrow ScanDg;
/**
* GC scan hook, called FOR each thread. Can be used to scan
* additional thread local memory.
*/
void scan(void* data, scope ScanDg dg) nothrow
{
// do module specific marking
}
alias int delegate(void* addr) nothrow IsMarkedDg;
/**
* GC sweep hook, called FOR each thread. Can be used to free
* additional thread local memory or associated data structures. Note
* that only memory allocated from the GC can have marks.
*/
void processGCMarks(void* data, scope IsMarkedDg dg) nothrow
{
// do module specific sweeping
rt.lifetime.processGCMarks(*(cast(Data*)data).blockInfoCache, dg);
}
|