Re: Question about threads which share a function
- From: Ben Bacarisse <ben.usenet@xxxxxxxxx>
- Date: Wed, 02 Jun 2010 17:33:10 +0100
"Joe" <Joe@xxxxxxxxxxxxxx> writes:
I have a function defined as void foo(int* pIn, int* pOut). The
function gets some data via pointer pIn and calculates some output
data which is written to the array pointed to by pOut. In the
calculation of the output, some local variables defined in foo are
used.
If I have two or more threads executing and these threads use foo, are
there any risks that something might go wrong; like the output being
screwed up and deviating from what is expected?
Most definitely. For example, if two concurrent calls to foo in
different threads have output arrays that overlap (or an input array
overlapping an output array).
You might find comp.programming.threads to be more suitable as your
design gets more detailed.
--
Ben.
.
- References:
- Prev by Date: Question about threads which share a function
- Next by Date: Re: Question about threads which share a function
- Previous by thread: Question about threads which share a function
- Next by thread: Re: Question about threads which share a function
- Index(es):
Relevant Pages
|