// //------------------ DOK FILE -------------------------------------------------- +Header oblivion =pkg bios =title Oblivion =short A mecanism to prevent unwanted desallocation. =desc The Oblivion element does not much: it calls a function when it should normally be erased by the Garbage collector. This is a useful mecanism in various occasions. For example when using [[Join]] it may happen that a thread is freezed in [[joinWait]] while the join is forgotten by other threads. When this happens, the thread is locked forever. Using an Oblivion element makes possible to attach a function to such a Join, and this function will be called by a new thread when the GC was supposed to delete the join. This function may call [[joinSend]] to free the awaiting thread. Remaining oblivion element functions are also called before the virtual machine exits. // // //------------------ PROTO ----------------------------------------------------- Oblivion +Proto Oblivion =type Oblivion =mode type =pkg bios =impl native =link =desc The Oblivion type // // //------------------ PROTO ----------------------------------------------------- oblivionCreate +Proto oblivionCreate =type fun (fun -> a1) -> Oblivion =mode Function =pkg bios =impl mcy =link =desc This function creates an Oblivion element attached to a function. This function will be called only once when the element is about to be deallocated by the Garbage collector. It is called in a dedicated thread. In particular, the function is called before the virtual machine terminates, when it deallocates everything. // +arg f =type fun -> a1 =desc A function with no argument // +arg result =type Oblivion =desc The oblivion element