PreviewLoader: change 2^(20) to pow(2, 20)?

Richard Kimberly Heck rikiheck at lyx.org
Sat Mar 28 18:57:31 UTC 2020


On 3/28/20 1:10 PM, Scott Kostyshak wrote:
> Can someone check whether the attached changes make sense? The first
> patch just changes the code to what I think is intended. But is it worth
> it to include the <cmath> header for this one expression or should we
> put the hardcoded value and in a comment note that it equals 2^20?
>
> The second patch increases pow(2, 20) to pow(2, 22), which is
> PID_MAX_LIMIT on most 64-bit systems, but perhaps there was a reason
> pow(2, 20) was used? I don't understand the purpose of these fake PIDs
> so I'm not sure.

How about (1 << 22) + 1, which we use elsewhere?

We usually track preview processes by their pids, which we get from
ForkedProcess. But since we are waiting for the result in this case, we
don't get a real pid (and don't need it), so we just use some arbitrary
integer.

Riki




More information about the lyx-devel mailing list