As I know threads share the memory. But, what about the local variables in the thread function? if i call multiple threads would they allocate seperate local variables for themselves?
like
Are the above local variables defined for each of the threads? in that case if i call threads simultaneously, their local variables will not conflict
Every thread has its own stack. Hence, in your example, i and j would be hence "private to the threads" and thus their local variables "would not conflict".
Of course, if another thread happens to know the address of variable i (or j) of a thread, it may access/modify it. But that's not an usual pattern.
HTH, Loïc
This User Gave Thanks to Loic Domaigne For This Post:
Hi,
I am trying to do an rsh and execute the same script on a distant unix computer.
The problem is that I need to get all the local variables of the distant computer to launch correctly my script.
I'm working on AIX 4.3.3
I try to execute .profile in the rsh but it seems not to be... (1 Reply)
Hi,
I have a small test c program which tries to dlopen a shared library(libjvm.sl).
But i get error as "Can't dlopen() a library containing Thread Local Storage"
My program is as below
when i run the program i get error
any pointers why the error??
I am using hp-ux . The... (1 Reply)
Is it possible to make function variables local?
I mean for example, I have a script variable 'name' and in function I have declared variable 'name'
I need to have script's 'name' have the same value as it was before calling the function with the same declaration.
The way to preserve a... (5 Replies)
Hi All,
Can you please tell me how to execute local function written in a shell script with awk.
i tried with system command but its giving an error. (1 Reply)
Hi,
I have the following statement which parses a string for me and prints it out:
l_comp="dc000.runksh.test.ksh|
$g_sql/dc0000.runksh_test.sql|new.dat|control.ctl"
echo $l_comp | awk -F"|" '{ for ( i = 1; i <= NF; i++) { print $i; } } '
Rather then printing the data, I would like to... (5 Replies)
(I think this question desearves separate thread..)
I have a problem with 'while'
I am trying to set variables by 'while' and it is fine inside, but after completting the loop all changes are lost:
> bb="kkkk - 111\nlllll - 22222\nbbbb - 4444"
> echo "$bb"
kkkk - 111
lllll - 22222
bbbb -... (3 Replies)
What I'm given:
Pure C code in one file that has to compile on Windows, SunOS, and AIX. My task is making minimal changes to the code to make it thread safe. I'm not in control of threads - they are created elsewhere. The code has a function invoked externally. The first call to this function is... (1 Reply)
Hi,
If I have a code like this, what are the potential problems do you see?
const char* const retString() {
return "hello"; /* string literal */
}
My questions are:
a) Since the string literal which is already a constant read only data (cannot be... (4 Replies)
I have tried to thoroughly search other threads before posting this question...
I have a shell script (bsh) that I'd like to "re-execute" if the user chooses to. Before the program is executed again the local variables (those set within the script) need to be unset. Is there a command that... (6 Replies)
Hi,
If I declare a function inside another function, it overwrites any previously declared function with the same name. This is NOT what I want.
Example:
#!/bin/bash
_test() { echo test; }
_myf() {
# I'm using the same name as the other function.
_test() { echo local test; }... (8 Replies)
Discussion started by: chebarbudo
8 Replies
LEARN ABOUT ULTRIX
threads
Portable Threads Abstraction Classes(3) Coin Portable Threads Abstraction Classes(3)NAME
Portable Threads Abstraction Classes -
Classes
class SbBarrier
The SbBarrier class implements the 'barrier' multi-thread synchronization technique.
A barrier is a synchronization mechanism that is used for blocking threads as they enter the barrier until a given number of threads are
blocked, at which point all the threads are released again. "
class SbCondVar
A class for synchronizing access to global variables.
Condition variables are used to protect global variables in an environment where multiple threads are running concurrently. "
class SbFifo
A class for managing a pointer first-in, first-out queue.
class SbMutex
A basic class for managing a mutex.
This class provides a portable framework around the mutex interface of the underlying native thread-handling toolkit. "
class SbThreadAutoLock
Simple convenience class for locking access to a function.
This class provides a simple convenience mechanism for automatically locking access to a function that is not re-entrant. "
class SbRWMutex
class SbStorage
The SbStorage class manages thread-local memory.
This class manages thread-local memory. When different threads access the memory an SbStorage object manages, they will receive different
memory blocks back. "
class SbTypedStorage< Type >
The SbTypedStorage class manages generic thread-local memory.
This class manages thread-local memory. When different threads access the memory an SbTypedStorage object manages, they will receive
different memory blocks back. "
class SbThread
A class for managing threads.
This class provides a portable framework around the tasks of instantiating, starting, stopping and joining threads. "
Detailed Description
Coin implements a set of abstractions over the native threads data types that can be portably used across all the platforms Coin has been
ported to.
Author
Generated automatically by Doxygen for Coin from the source code.
Version 3.1.3 Wed May 23 2012 Portable Threads Abstraction Classes(3)