On 26/03/2025 13:43, Qingfang Deng wrote:
On Wed, Mar 26, 2025 at 6:22 PM Antonio Quartulli antonio@openvpn.net wrote:
This is not what we want.
Got it. You could replace it with atomic_fetch_add_unless(&pid->seq_num, 1, 0) and check if it wraps around to zero.
What about the first time when seq_num is 0? It will already stop, no?
The initial value of seq_num is 1.
Ah, you're right. Because atomic_fetch_add_unless() returns the original value.
Then I think your whole suggestion makes sense. I will switch to atomic_t (32bit) and check for the wrap-around.
Cheers,