Browse Source

!562 __pthread_exit()可能不会唤醒被当前线程阻塞的线程的问题
Merge pull request !562 from PolarLush/rt-smart

bernard 2 years ago
parent
commit
c00de480c0
2 changed files with 8 additions and 2 deletions
  1. 1 1
      bsp/qemu-virt64-aarch64/qemu.sh
  2. 7 1
      components/lwp/lwp_futex.c

+ 1 - 1
bsp/qemu-virt64-aarch64/qemu.sh

@@ -1,7 +1,7 @@
 if [ ! -f "sd.bin" ]; then
 dd if=/dev/zero of=sd.bin bs=1024 count=65536
 fi
-qemu-system-aarch64 -M virt,gic-version=2,virtualization=on,secure=on -cpu cortex-a53 -smp 4 -kernel rtthread.bin -nographic
+qemu-system-aarch64 -M virt,gic-version=2 -cpu cortex-a53 -smp 4 -kernel rtthread.bin -nographic \
 -drive if=none,file=sd.bin,format=raw,id=blk0 -device virtio-blk-device,drive=blk0,bus=virtio-mmio-bus.0 \
 -netdev user,id=net0 -device virtio-net-device,netdev=net0,bus=virtio-mmio-bus.1 \
 -device virtio-serial-device -chardev socket,host=127.0.0.1,port=4321,server=on,wait=off,telnet=on,id=console0 -device virtserialport,chardev=console0

+ 7 - 1
components/lwp/lwp_futex.c

@@ -187,7 +187,13 @@ int sys_futex(int *uaddr, int op, int val, const struct timespec *timeout,
         rt_set_errno(EINVAL);
         return -RT_EINVAL;
     }
-    if (timeout)
+
+    /** 
+     * if (op & (FUTEX_WAKE|FUTEX_FD|FUTEX_WAKE_BITSET|FUTEX_TRYLOCK_PI|FUTEX_UNLOCK_PI)) was TRUE
+     * `timeout` should be ignored by implementation, according to POSIX futex(2) manual.
+     * since only FUTEX_WAKE is implemented in rt-smart, only FUTEX_WAKE was omitted currently
+     */
+    if (timeout && !(op & (FUTEX_WAKE)))
     {
         if (!lwp_user_accessable((void *)timeout, sizeof(struct timespec)))
         {