next | previous | forward | backward | up | top | index | toc | Macaulay2 website
Macaulay2Doc > The Macaulay2 language > parallel programming with threads and tasks > threadVariable

threadVariable -- create a symbol whose value in one thread is not shared with others

Synopsis

Description

i1 : threadVariable x

o1 = x

o1 : Symbol
i2 : x = 1

o2 = 1
i3 : t = schedule ( () -> ( x = 2 ; x ) )

o3 = <<task, result available, task done>>

o3 : Task
i4 : while not isReady t do null
i5 : taskResult t

o5 = 2
i6 : x

o6 = 1

For the programmer

The object threadVariable is a keyword.