The instructions in the new thread may use local variables of the calling function. These variable will be automatically copyed in the new thread environment.If you want the new thread not to copy a variable but rather use the original one, you can use the 'share' function to indicate that the variable is common to both threads. If you do so, you have to use semaphores to protect the access to the variable whenever it is required.
The basic idea with 'parallel' instruction is that a fixed number of tasks will be executed in parallel.
parallel [threads nb_threads] [mini mini_threshold] [maxi maxi_threshold] [active]
The queue will execute 'nb_threads' tasks at once, in parallel will the main thread that runs the body of the 'parallel' instruction in order to fill the queue.When 'maxi_threshold' items are waiting in the queue, any attempt to put one more will result in:
When a task contains a 'post' section, the instructions of the 'post' section will be executed sequentially (the ones of the first recorded task will be executed first, then the ones of the second recorded task, and so one). All these post instructions are run in a single another thread.