-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
pthread: remove enter_critical_section in pthread_barrier_wait #14626
base: master
Are you sure you want to change the base?
Conversation
[Experimental Bot, please feedback here] This PR appears to partially meet the NuttX requirements. Here's a breakdown: Strengths:
Weaknesses (requiring further information in the PR):
To fully meet the NuttX requirements, the PR needs to:
By addressing these points, the PR will be much clearer and easier for reviewers to evaluate. |
sched/pthread/pthread_barrierwait.c
Outdated
@@ -80,69 +82,43 @@ | |||
* | |||
****************************************************************************/ | |||
|
|||
static spinlock_t barrier_wait_lock = SP_UNLOCKED; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but, we should avoid to use global variable.
reason: We decouple semcount from business logic by using an independent counting variable, which allows us to remove critical sections in many cases. Signed-off-by: hujun5 <[email protected]>
Summary
reason:
We decouple semcount from business logic by using an independent counting variable, which allows us to remove critical sections in many cases.
Impact
pthread_barrier_wait
Testing
Build Host:
OS: Ubuntu 20.04
CPU: x86_64
Compiler: GCC 9.4.0
Configuring NuttX and compile:
$ ./tools/configure.sh -l qemu-armv8a:nsh_smp
$ make
Running with qemu
$ qemu-system-aarch64 -cpu cortex-a53 -smp 4 -nographic
-machine virt,virtualization=on,gic-version=3
-net none -chardev stdio,id=con,mux=on -serial chardev:con
-mon chardev=con,mode=readline -kernel ./nuttx