On Thu, Dec 19, 2013 at 12:55 PM, Scott Ford <scott_j_f...@yahoo.com> wrote:

> I have a C threading question.. My scenario multiple C threads, posix(on),
> who all can call a Cobol "thread" aware program in the threads, with their
> own local-storage. My question is  "will each thread have storage that will
> be separate from each other ?" These called programs have the same variable
> names in local-storage .
>

Yes, according to
Ref:
http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/igy3pg31/4.4
<quote>

 *Choosing* *LOCAL-STORAGE* *or* *WORKING-STORAGE:* Because you must code
your multithreaded programs as recursive, the persistence of data is that
of any recursive program:


   - Data items in the LOCAL-STORAGE SECTION are automatically allocated
   for each instance of a program invocation. When a program runs in multiple
   *threads* simultaneously, each invocation has a separate copy of
   LOCAL-STORAGE data.

   - Data items in the WORKING-STORAGE SECTION are allocated once for each
   program and are thus available in their last-used state to all invocations
   of the program.


For the data that you want to isolate to an individual program invocation
instance, define the data in the LOCAL-STORAGE SECTION. In general, this
choice is appropriate for working data in *threaded* programs. If you
declare data in WORKING-STORAGE and your program changes the contents of
the data, you must take one of the following actions:


   - Structure your application so that you do not access data in
   WORKING-STORAGE simultaneously from multiple *threads*.

   - If you do access data simultaneously from separate *threads*, write
   appropriate serialization code.


</quote>


>
> Scott ford
> www.identityforge.com
> from my IPAD
>
> 'Infinite wisdom through infinite means'
>
>


-- 
This is clearly another case of too many mad scientists, and not enough
hunchbacks.

Maranatha! <><
John McKown

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

Reply via email to