I want to use the process_flag(priority, Level) to set the priority of a process. I am a little confused as to where it should go in my code and can't seem to find an example.
The two options that I can see are:
(1) Set the flag before spawning the process:
process_flag(priority, max),
register(myprocess, spawn(fun() -> myprocess() end)),
(2) Set the flag within the function after it has been spawned:
myprocess() ->
process_flag(priority, max),
%do stuff
Also, if option 1 is correct, do I need to reset the flag to normal
before spawning other processes?