Function using in multi threaded environment

Hi,

I have a doubt about function usage in multi threaded environment. Think, we have a small c file call "functiontest.c". This file contains a small function call "process".

1
2
3
4
5
6
7
8
9
10
11
12

// content of functiontest.c file

int process(int a,int b)
{
    int c = (a+b) * 2;

    c += 10;

    return c;
}


If we try to access this "process" function in multi threaded environment will it gives correct answers to each thread?? Can you please explain this?

Thank you.
Yes it should be no problems here because no data is shared between the threads. Each call to process will have its own copy of a, b and c.
Last edited on
Hi,

I understood. :)

Thank you
Topic archived. No new replies allowed.