IBM AS/400 manual Multithreaded Applications, RPG Programming in ILE, suppo, Thread*Serealize

Models: AS/400

1 489
Download 489 pages 47.95 Kb
Page 45
Image 45
Multithreaded Applications

RPG Programming in ILE

¹CEEDOD – Decompose Operational Descriptor

Note: You cannot use these or any other ILE bindable APIs from with created with DFTACTGRP(*YES). This is because bound calls are not allowed in this type of program.

For more information on these ILE bindable APIs, see Chapter 9, “Running Program” on page 103 and alsoSystemtheAPI Reference.

Multithreaded Applications

The AS/400 now supports multithreading. ILE

RPG

does

 

not

directly

suppo

ating or managing program threads. However, ILE RPG

procedures

can

r

threads

in

multithreaded

environments.

If

you

want

 

to

call

an

ILE

RP

a multithreaded application, you must ensure that the ILE RPG proce

threadsafe. You must also ensure that any system functions that you

accesses

are

also

threadsafe.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

The

THREAD(*SEREALIZE)

control

specification

keyword

can

be

specified

t

you achieve thread safety for an ILE RPG module. Specifying

 

 

THREAD(*SERIALIZE) will protect most of your variables

and

all

 

your

inte

control structures from being accessed

improperly

by

multiple

 

threads

safe module will be locked when a procedure in

the

module

 

is

ente

unlocked when when no procedure in the

module

 

is

still

running.

This

s

access, ensures that only one thread

 

is

active

in

any

one

module,

vation group, at any one time. However, it is

still

up

to

the

progr

thread

safety for

storage

that is

shared

across

modules. This

is

logic in

the

application

to

synchronize

access

to

the

 

storage.

 

 

For

more

information,

see

“Multithreading

Considerations”

on

page 157.

 

Chapter 2. RPG Programming in ILE21

Page 45
Image 45
IBM AS/400 manual Multithreaded Applications, suppo, Thread*Serealize, RPG Programming in ILE21