Netscape Portable Runtime
Template:Short description Template:Multiple issues {{#invoke:Infobox|infobox}}Template:Template other{{#invoke:Check for unknown parameters | check | showblankpositional=1 | unknown = Template:Main other | preview = Page using Template:Infobox software with unknown parameter "_VALUE_"|ignoreblank=y | AsOf | author | background | bodystyle | caption | collapsetext | collapsible | developer | discontinued | engine | engines | genre | included with | language | language count | language footnote | latest preview date | latest preview version | latest release date | latest release version | latest_preview_date | latest_preview_version | latest_release_date | latest_release_version | licence | license | logo | logo alt | logo caption | logo upright | logo size | logo title | logo_alt | logo_caption | logo_upright | logo_size | logo_title | middleware | module | name | operating system | operating_system | other_names | platform | programming language | programming_language | released | replaced_by | replaces | repo | screenshot | screenshot alt | screenshot upright | screenshot size | screenshot title | screenshot_alt | screenshot_upright | screenshot_size | screenshot_title | service_name | size | standard | title | ver layout | website | qid }}Template:Main other
The Netscape Portable Runtime, or NSPR, is a cross-platform abstraction layer library for the C programming language. It provides a uniform API for various operating system functions.<ref name="nspr-index">{{#invoke:citation/CS1|citation |CitationClass=web }}</ref>
HistoryEdit
NSPR was originally designed to provide a base for the Java virtual machine in Netscape 5. Over time it was extended to allow support for additional functionality used for Netscape's server and client software.<ref name="nspr-about">{{#invoke:citation/CS1|citation |CitationClass=web }}</ref> NSPR continues to be used today by Firefox as well as many of Oracle and Red Hat's server products.<ref name="nspr-index" />
FeaturesEdit
ThreadsEdit
NSPR provides a thread API. It uses the OS's threading capabilities where possible. It also provides support for sharing memory between threads, as well as creating and using thread pools. Locks, atomics, semaphores, and both cached and uncached monitors are provided.<ref name="nspr-api">{{#invoke:citation/CS1|citation |CitationClass=web }}</ref>
I/OEdit
NSPR provides functions for working with files, directories, anonymous pipes and network sockets.<ref name="nspr-api" />
Network addressesEdit
NSPR defines an IP-centric network address object. Functions are provided to translate ASCII strings (DNS names) into NSPR's network address structures, regardless of whether the addressing technology uses IPv4 or IPv6.<ref name="nspr-about" /><ref name="nspr-api" />
TimeEdit
NSPR makes timing facilities available in two forms: interval timing and calendar functions.
Interval timers are based on a free running 32-bit resolution timer. Their epoch and interval can be set as needed.
Calendar times are represented using 64-bit signed Unix time. NSPR provides functions for manipulating and converting timestamps.<ref name="nspr-about" /><ref name="nspr-api" />
Memory managementEdit
NSPR provides API to perform the basic malloc, calloc, realloc and free functions. Depending on the platform, the functions may be implemented almost entirely in the NSPR runtime or simply shims that call immediately into the host operating system's offerings.<ref name="nspr-about" /><ref name="nspr-api" />
LinkingEdit
Support for linking (shared library loading and unloading) forms part of NSPR's feature set. In most cases this is simply a smoothing over of the facilities offered by the various platform providers.<ref name="nspr-about" /><ref name="nspr-api" />
Data structuresEdit
NSPR provides implementations of a circular linked list and a hash table.<ref name="nspr-api" />