libcommunism
Userspace cooperative threading library
Namespaces | Classes | Functions
libcommunism Namespace Reference

Main namespace for the libcommunism library. More...

Namespaces

 internal
 Implementation details (including architecture/platform specific code) for the library.
 

Classes

struct  CothreadImpl
 Abstract interface for a platform implementation of cothreads. More...
 
class  Cothread
 Instance of a single cooperative thread. More...
 

Functions

CothreadImplAllocKernelThreadWrapper ()
 

Detailed Description

Main namespace for the libcommunism library.

Function Documentation

◆ AllocKernelThreadWrapper()

CothreadImpl * libcommunism::AllocKernelThreadWrapper ( )

Allocate the cothread implementation for the currently executing kernel thread.

This is invoked when no cothread is running on the kernel thread, and is only used to hold the state of the kernel thread on entry to the first cothread, so it can "resume" the kernel thread.

Remarks
Only one definition of this method is allowed; it's typically provided by the platform code selected via build configuration.

Allocates the current physical (kernel) thread's Cothread object.

Note
This will leak the associated cothread object, unless the caller stores it somewhere and ensures they deallocate it later when the underlying kernel thread is destroyed.

Definition at line 134 of file Common.cpp.

134  {
135  return new Aarch64(Aarch64::gMainStack);
136 }
Architecture specific methods for working with cothreads on 64 bit ARM machines.
Definition: Common.h:18