It is displayed for the entire process, that is, for all threads. Of course, this is in practice. You could not theoretically say that streams have nothing to do with the C standard (at least until c99, which is the standard that was valid when this question was asked).
But all the thread libraries I have ever used would have global variables available to all threads.
Update 1:
Many thread libraries (pthreads for one) will allow you to create streaming data, a means to create and use thread-specific data without passing through a function.
So, for example, a function to return pseudo-random numbers may require that each thread have an independent seed. Therefore, every time he calls this, he creates or attaches to a certain thread a block containing this seed (using some kind of key).
This allows functions to maintain the same signature as non-streaming (which is important if they are ISO C functions, for example), since another solution involves adding a thread-specific pointer to the function call itself.
Another possibility is to have an array of globals from which each thread gets one, for example:
int fDone[10]; int idx; : : : for (i = 0; i < 10; i++) { idx = i; startThread (function, i); while (idx >= 0) yield(); } void function () { int myIdx = idx; idx = -1; while (1) { : : : } }
This will let the flow function know which global variable in the array belongs to it.
There are other methods, no doubt, but without knowing the target environment, there is not much to discuss them.
Update 2:
The easiest way to use an unsafe library in a streaming environment is to provide wrapper calls with mutex protection.
For example, let's say your library has a function other than streaming doThis() . What you do is a shell for it:
void myDoThis (a, b) { static mutex_t serialize; mutex_claim (&serialize); doThis (a, b); mutex_release (&serialize); }
What will happen is that only one thread at a time will be able to request the mutex (and therefore, call a function other than the stream). Others will be blocked until the current one returns.