PREV UP next StackThreads/MP: version 0.77 User's Guide

6.2: Calling StackThreads/MP Procedure from Sequential Procedure

First of all, you cannot call any StackThreads/MP procedure from a sequential procedure by default. A special setup procedure is mandatory. This is primarily because StackThreads/MP procedures reserve a register and assume that the register always holds the pointer to the worker-local storage, and a sequential procedure does not know the fact. Even if a StackThreads/MP procedure does not call any StackThreads/MP primitive that explicitly accesses a worker-local storage, it does so in its epilogue code. Therefore, as an approximation, remember that you cannot call any StackThreads/MP procedure unless you follow the necessary steps described below.

We provide two ways for different situations. One is suitable when you want to extract parallelism in the callback. The other is suitable when the amount of work done in the callback is very small.

  • Create a Worker Group
  • Setup TLS Pointers