FeynKit · latest
On this page

CancellationToken

symbolica.community.hepkit Class

CancellationToken()

A thread-safe signal for cancelling a long diagram-generation job.

Pass one token as cancellation_token and call cancel from a controlling thread when a large topology search should stop early.

Examples

from symbolica.community import hepkit as hep
token = hep.CancellationToken()
token.is_cancelled

Constructor

#

Create an independent token that can cancel a generation request.

Examples

Using the setup in the CancellationToken class example:

token = hep.CancellationToken()

Member details

is_cancelled

Property · read-only#
is_cancelled: bool

Report whether cancellation has been requested.

Examples

Using the setup in the CancellationToken class example:

token = hep.CancellationToken()
token.cancel()
token.is_cancelled

cancel

Method#
cancel() -> None

Mark this token as cancelled for all generation requests using it.

Examples

Using the setup in the CancellationToken class example:

token.cancel()