Threadsafe Code

All BSFNs created for JD Edwards EnterpriseOne 8.11 Applications Release and earlier Applications releases are designed to run in a single-threaded environment. BSFNs designed for JD Edwards EnterpriseOne 8.11 SP1 Applications Release and later Applications releases that also run with JD Edwards EnterpriseOne Tools Release 8.96 and later Tools releases are designed to run in a multi-threaded environment. To be considered threadsafe, BSFNs cannot use:

  • Global variables.

  • Static variables.

  • External declarations.

  • Non-threadsafe ANSI C APIs.

Safety Check is a source code analysis tool that scans C source code and header files for non-threadsafe behaviors. Given a source or header file, Safety Check finds all instances of non-threadsafe code, returning line numbers and code fragments.

Several non-threadsafe APIs have a JD Edwards EnterpriseOne replacement. These replacement APIs have the same parameters as the non-threadsafe C APIs, except where noted. Most non-threadsafe APIs do not have a JD Edwards EnterpriseOne replacement. These APIs and their replacements do not necessarily have the same parameters. Use care when using these APIs.

This table lists the non-threadsafe C APIs for which SafetyCheck searches, the threadsafe standard C replacements, and the threadsafe JD Edwards EnterpriseOne replacements (if applicable):

Non-Threadsafe Standard C API

Threadsafe Standard C API

Threadsafe JD Edwards EnterpriseOne API

acltostr

acltostr_r

None

asctime

asctime_r

jdeJAsctime

crypt

crypt_r

None

ctime

ctime_r

jdeJCtime

drand48

drand48_r

None

ecvt

ecvt_r

None

encrypt

encrypt_r

None

endgrent

endgrent_r

None

endhostent

endhostent_r

None

endnetent

endnetent_r

None

endprotoent

endprotoent_r

None

endpwent

endpwent_r

None

endservent

endservent_r

None

endspwent

endspwent_r

None

endusershell

endusershell_r

None

endutent

endutent_r

None

erand48

erand48_r

None

fcvt

fcvt_r

None

fgetgrent

fgetgrent_r

None

fgetpwent

fgetpwent_r

None

getdate

getdate_r

None

getdiskbyname

getdiskbyname_r

None

getgrent

getgrent_r

None

getgrgid

getgrgid_r

None

getgrnam

getgrnam_r

None

gethostbyaddr

gethostbyaddr_r

jdeGetHostByAddr_r

gethostbyname

gethostbyname_r

jdeGetHostByName_r

gethostent

gethostent_r

None

getlocale

getlocale_r

None

getlogin

getlogin_r

None

getnmtent

getmntent_r

None

getnetbyaddr

getnetbyaddr_r

None

getnetbyname

getnetbyname_r

None

getnetent

getnetent_r

None

getprotobyname

getprotobyname_r

jdeGetProtoByName_r

getprotobynumber

getprotobynumber_r

None

getprotoent

getprotoent_r

None

getpwent

getpwent_r

None

getpwnam

getpwnam_r

None

getpwuid

getpwuid_r

None

getservbyname

getservbyname_r

None

getservbyport

getservbyport_r

None

getservent

getservent_r

None

getspwaid

getspwaid_r

None

getspwnam

getspwnam_r

None

getspwuid

getspwuid_r

None

getusershell

getusershell_r

None

getutent

getutent_r

None

getutid

getutid_r

None

getutline

getutline_r

None

gmtime

gmtime_r

jdeGmtime

inet_ntoa

inet_ntoa_r

jde_inet_ntoa_r

jrand48

jrand48_r

None

l64a

l64a_r

None

lcong48

lcong48_r

None

localtime

localtime_r

jdeLocaltime

Note: The parameters changed on this due to the need to send a location to store the value. The standard C call stores it in a global static variable, which is not threadsafe.

lrand48

lrand48_r

None

ltoa

ltoa_r

None

ltostr

ltostr_r

None

mrand48

mrand48_r

None

nrand48

nrand48_r

None

ptsname

ptsname_r

None

pututline

pututline_r

None

rand

rand_r

jdePPRand

Note: Must be used in conjunction with jdePPSRand to seed the random number generator correctly. Existing calls to srand should be replaced with jdePPSRand.

readdir

readdir_r

None

seed48

seed48_r

None

setgrent

setgrent_r

None

sethostent

sethostent_r

None

setkey

setkey_r

None

setlocale

setlocale_r

jdeSetLocale

setnetent

setnetent_r

None

setprotoent

setprotoent_r

None

setpwent

setpwent_r

None

setservent

setservent_r

None

setspwent

setspwent_r

None

setusershell

setusershell_r

None

setutent

setutent_r

None

srand

srand_r

jdePPSRand

srand48

srand48_r

None

strerror

strerror_r

None

strtoacl

strtoacl_r

None

strtoaclpatt

strtoaclpatt_r

None

strtok

strtok_r

None

ttyname

ttyname_r

None

ultoa

ultoa_r

None

ultostr

ultostr_r

None

utmpname

utmpname_r

None

wcstok

wcstok_r

None