|Did you know ...||Search Documentation:|
|Foreign hash tables|
As of SWI-Prolog 8.3.2 the foreign API provides access to the
internal thread-safe and lock-free hash tables that associate pointers
or objects that fit in a pointer such as atoms (
argument against providing these functions is that they have little to
do with Prolog. The argument in favor is that it is hard to implement
efficient lock-free tables without low-level access to the underlying
Prolog threads and exporting this interface has a low cost.
The functions below can only be called if the calling thread is associated with a Prolog thread. Failure to do so causes the call to be ignored or return the failure code where applicable.
NULLif key does not appear in the table.
0, this function returns the existing value without updating the table. If
PL_HT_UPDATEthe old value is replaced and the function returns the old value. If
PL_HT_NEW, a message and backtrace are printed and the function returns NULL if key is already in the table.