Priorities range from 1 (most urgent) to 12 (least urgent). The toplevel goal of an execution always runs at the lowest priority (12).
call_priority/2 runs a goal at a given priority. If this priority is higher than the one under which call_priority was invoked, the goal executes immediately, but will be less interruptable by woken goals. If the specified priority is lower, the execution of goal will be effectively deferred until there are no more urgent goal present.
Note that woken goals automatically execute under their associated run_priority (which is a property of the predicate that is being invoked). This is equivalent to a call_priority/2, therefore call_priority/2 is usually not needed inside woken predicates.
Warning: Although it is possible to write programs that only work correctly under a particular priority ordering, such practice is strongly discouraged. Priorities should only affect efficiency, never correctness.
[eclipse 1]: [user]. p :- call_priority(writeln(hello),8), writeln(world). user compiled traceable 136 bytes in 0.00 seconds yes. [eclipse 10]: call_priority(p,5). world hello yes. [eclipse 11]: call_priority(p,10). hello world yes. [eclipse 12]: call_priority(p,8). hello world yes.