Next: 4.5 Garbage collection Up: 4. The libonyx library Previous: 4.3 Multiple interpreters Contents Index

# 4.4 Threads

libonyx encapsulates each interpreter instance in an nx object. An nx object supports running multiple concurrent threads. Each thread context is encapsulated by an nxo thread object.

In general, each process thread should execute in its own nxo thread object context, though the only explicit restriction placed on nxo thread object operations is that only one thread can be executing in an nxo thread object context at a time. In other words, the nxo thread class does not synchronize access to its internals, since there is normally no reason for multiple threads to execute in the same nxo thread object context.