A method for running application programs supporting multiple contexts on
a computer system having an operating system supporting threads, and not
supporting multiple context processing instructions. The method is
characterized by processing (210) a context processing instruction from
said run-time application program, evaluating (220) said instruction in
relation to program-flow control yielding context-defining processing
parameters, analyzing (230) said context-defining processing parameters
(40) from the execution context of said context processing instruction in
regard of program flow management by threads, mapping said
context-processing instruction to a selected thread managing instruction,
or to a selected set of thread managing instructions, having a respective
program flow control effect equivalent to that of said context-processing
instruction, invoking (240, 250, 260) said selected thread managing
instruction or said set thereof, together with selected parameters for
guaranteeing that during runtime of said application program only one
thread is allowed to execute at a time, and the program state of a thread
may be stored at a given point in time and may be restored later from
said point in time.