>From this link: https://linux.die.net/man/3/setlogmask logmask has per task scope not per thread scope. So we still suffer the concurrent issue if we change to group-specific logmask.
-----Original Message----- From: Gregory Nutt <spudan...@gmail.com> Sent: Monday, May 11, 2020 10:59 AM To: dev@nuttx.apache.org Subject: Re: enter/leave_critical_section() calls in the user space library > >> One way to make this work correctly would be to remove the logmask as >> a global variable and, instead, put the logic mask in the group >> structure or in the TCB structure. That would make logmask thread >> safe (in the second case). This would be the preferred solution. >> This solution would work. The other suggestions will not work and >> just implement more complex version of the broken code. > Actually, putting the logmask in TLS (with the errno) would be better > solution. In some configurations, at least, that would avoid a system > call. I could implement that in about an hour if you agree. I think a per-thread log mask is better than a broken shared logmask. The logmask cannot be shared between threads. It is impossible to make that work correctly. The only options are: - Remove the critical section and don't worry about it, It is broken in the multi-threaded concurrent access (but your proposals do not fix that). - Implement a thread-specific, or group-specific logmask. Let me know.