GetCurrentFiber Function

Purpose

Returns an identification value for the current running fiber.

Syntax

addr% = GetCurrentFiber()

Description

The return value is the address of the currently running fiber. A fiber is 'lightweight' thread, with less overhead and easier to maintain. A fiber uses less resources and the time to activate a fiber is lesser than for a thread.

The CreateFiber and ConvertThreadToFiber functions return the fiber address when the fiber is created. The GetCurrentFiber function allows you to retrieve the address at any other time.

The functions GetTIB, GetCurrentFiber, and GetFiberData are generated using inline code and are for this reason implemented in GFABASIC 32.

GetCurrentFiber . mov eax, fs:[16]

GetFiberData . mov eax, fs:[16] : . mov eax, [eax]

GetTIB . mov eax, fs:[24]

Example

Remarks

GetCurrrentFiber() and GetFiberData() are supported for Windows NT and later. These functions are used together with corresponding API functions like: ConvertThreadToFiber, CreateFiber, SwitchToFiber, etc..

See Also

GetFiberData, GetTIB

{Created by Sjouke Hamstra; Last updated: 12/05/14 by James Gaite}