diff options
Diffstat (limited to 'src/gc/gcinterface.ee.h')
-rw-r--r-- | src/gc/gcinterface.ee.h | 35 |
1 files changed, 26 insertions, 9 deletions
diff --git a/src/gc/gcinterface.ee.h b/src/gc/gcinterface.ee.h index d65da60678..84578b6d8a 100644 --- a/src/gc/gcinterface.ee.h +++ b/src/gc/gcinterface.ee.h @@ -79,6 +79,9 @@ public: // Gets the Thread instance for the current thread, or null if no thread // instance is associated with this thread. + // + // If the GC created the current thread, GetThread returns null for threads + // that were not created as suspendable (see `IGCHeap::CreateThread`). virtual Thread* GetThread() = 0; @@ -98,9 +101,21 @@ public: virtual void GcEnumAllocContexts(enum_alloc_context_func* fn, void* param) = 0; - // Creates and returns a new background thread. - virtual - Thread* CreateBackgroundThread(GCBackgroundThreadFunction threadStart, void* arg) = 0; + // Creates and returns a new thread. + // Parameters: + // threadStart - The function that will serve as the thread stub for the + // new thread. It will be invoked immediately upon the + // new thread upon creation. + // arg - The argument that will be passed verbatim to threadStart. + // is_suspendable - Whether or not the thread that is created should be suspendable + // from a runtime perspective. Threads that are suspendable have + // a VM Thread object associated with them that can be accessed + // using `IGCHeap::GetThread`. + // name - The name of this thread, optionally used for diagnostic purposes. + // Returns: + // true if the thread was started successfully, false if not. + virtual + bool CreateThread(void (*threadStart)(void*), void* arg, bool is_suspendable, const char* name) = 0; // When a GC starts, gives the diagnostics code a chance to run. virtual @@ -192,16 +207,18 @@ public: virtual void FreeStringConfigValue(const char* value) = 0; - // Asks the EE about whether or not the current thread is a GC thread: - // a server GC thread, background GC thread, or the thread that suspended - // the EE at the start of a GC. + // Returns true if this thread is a "GC thread", or a thread capable of + // doing GC work. Threads are either /always/ GC threads + // (if they were created for this purpose - background GC threads + // and server GC threads) or they became GC threads by suspending the EE + // and initiating a collection. virtual bool IsGCThread() = 0; - // Asks the EE about whether or not the current thread is a GC "special" - // thread: a server GC thread or a background GC thread. + // Returns true if the current thread is either a background GC thread + // or a server GC thread. virtual - bool IsGCSpecialThread() = 0; + bool WasCurrentThreadCreatedByGC() = 0; }; #endif // _GCINTERFACE_EE_H_ |