XWOS API  4.0
XWOS C/C++ API参考手册
载入中...
搜索中...
未找到
Spinlock.hxx
浏览该文件的文档.
1
13#ifndef __xwos_cxx_lock_Spinlock_hxx__
14#define __xwos_cxx_lock_Spinlock_hxx__
15
18
19namespace xwos {
20namespace lock {
21
245{
246 public:
253 };
254
264 class LkGrd
265 {
266 protected:
269
270 public:
275 LkGrd(Spinlock * spinlock);
276
281 LkGrd(Spinlock & spinlock);
282
286 ~LkGrd();
287
291 enum LockStatus getStatus() { return mStatus; }
292
314 xwer_t wait(sync::Cond * cond);
315
325 xwer_t wait(sync::Cond & cond) { return wait(&cond); }
326
351 xwer_t wait(sync::Cond * cond, xwtm_t to);
352
363 xwer_t wait(sync::Cond & cond, xwtm_t to) { return wait(&cond, to); }
364
365 protected:
367 };
368
380 : public LkGrd
381 {
382 private:
385 public:
390 TryLkGrd(Spinlock * spinlock);
391
396 TryLkGrd(Spinlock & spinlock);
397
402
409 xwer_t getRc() { return mRc; }
410 };
411
423 {
424 protected:
429 public:
434 LkThGrd(Spinlock * spinlock);
435
440 LkThGrd(Spinlock & spinlock);
441
445 ~LkThGrd();
446
450 enum LockStatus getStatus() { return mStatus; }
451
473 xwer_t wait(sync::Cond * cond);
474
484 xwer_t wait(sync::Cond & cond) { return wait(&cond); }
485
510 xwer_t wait(sync::Cond * cond, xwtm_t to);
511
522 xwer_t wait(sync::Cond & cond, xwtm_t to) { return wait(&cond, to); }
523
524 protected:
526 };
527
540 : public LkThGrd
541 {
542 private:
545 public:
550 TryLkThGrd(Spinlock * spinlock);
551
556 TryLkThGrd(Spinlock & spinlock);
557
562
569 xwer_t getRc() { return mRc; }
570 };
571
582 {
583 protected:
586
587 public:
592 LkBhGrd(Spinlock * spinlock);
593
598 LkBhGrd(Spinlock & spinlock);
599
603 ~LkBhGrd();
604
608 enum LockStatus getStatus() { return mStatus; }
609
631 xwer_t wait(sync::Cond * cond);
632
642 xwer_t wait(sync::Cond & cond) { return wait(&cond); }
643
668 xwer_t wait(sync::Cond * cond, xwtm_t to);
669
680 xwer_t wait(sync::Cond & cond, xwtm_t to) { return wait(&cond, to); }
681
682 protected:
684 };
685
698 : public LkBhGrd
699 {
700 private:
703 public:
708 TryLkBhGrd(Spinlock * spinlock);
709
714 TryLkBhGrd(Spinlock & spinlock);
715
720
727 xwer_t getRc() { return mRc; }
728 };
729
741 template<xwirq_t ... TIrqList>
743 {
744 protected:
747 xwirq_t mIrqs[sizeof...(TIrqList)];
748 xwreg_t mIrqFlags[sizeof...(TIrqList)];
749
750 public:
755 LkIrqsGrd(Spinlock * spinlock);
756
761 LkIrqsGrd(Spinlock & spinlock);
762
766 ~LkIrqsGrd();
767
771 enum LockStatus getStatus() { return mStatus; }
772
794 xwer_t wait(sync::Cond * cond);
795
805 xwer_t wait(sync::Cond & cond) { return wait(&cond); }
806
831 xwer_t wait(sync::Cond * cond, xwtm_t to);
832
843 xwer_t wait(sync::Cond & cond, xwtm_t to) { return wait(&cond, to); }
844
845 protected:
847 };
848
862 template<xwirq_t ... TIrqList>
864 : public LkIrqsGrd<TIrqList ...>
865 {
866 private:
869 public:
874 TryLkIrqsGrd(Spinlock * spinlock);
875
880 TryLkIrqsGrd(Spinlock & spinlock);
881
886
893 xwer_t getRc() { return mRc; }
894 };
895
896 private:
899 public:
900 Spinlock();
901 ~Spinlock();
902 struct xwos_splk * getXwosObj() { return &mLock; }
903};
904
909} // namespace lock
910} // namespace xwos
911
912#endif /* xwos/cxx/lock/Spinlock.hxx */
xwos::sync::Cond
中断底半部上锁模式下的自旋锁RAII机制守卫
Definition Spinlock.hxx:582
xwer_t wait(sync::Cond &cond)
等待条件量
Definition Spinlock.hxx:642
xwer_t wait(sync::Cond *cond)
等待条件量
Definition Spinlock.cxx:263
~LkBhGrd()
析构自旋锁的RAII机制守卫
Definition Spinlock.cxx:253
enum LockStatus getStatus()
获取锁状态
Definition Spinlock.hxx:608
xwer_t wait(sync::Cond &cond, xwtm_t to)
限时等待条件量
Definition Spinlock.hxx:680
普通上锁模式下的自旋锁RAII机制守卫
Definition Spinlock.hxx:265
xwer_t wait(sync::Cond &cond, xwtm_t to)
限时等待条件量
Definition Spinlock.hxx:363
xwer_t wait(sync::Cond &cond)
等待条件量
Definition Spinlock.hxx:325
xwer_t wait(sync::Cond *cond)
等待条件量
Definition Spinlock.cxx:49
~LkGrd()
析构自旋锁的RAII机制守卫
Definition Spinlock.cxx:39
enum LockStatus getStatus()
获取锁状态
Definition Spinlock.hxx:291
部分中断上锁模式的自旋锁RAII机制守卫
Definition Spinlock.hxx:743
~LkIrqsGrd()
析构自旋锁的RAII机制守卫
Definition Spinlock.cxx:365
xwer_t wait(sync::Cond &cond)
等待条件量
Definition Spinlock.hxx:805
xwer_t wait(sync::Cond *cond)
等待条件量
Definition Spinlock.cxx:377
enum LockStatus getStatus()
获取锁状态
Definition Spinlock.hxx:771
xwreg_t mIrqFlags[sizeof...(TIrqList)]
Definition Spinlock.hxx:748
xwirq_t mIrqs[sizeof...(TIrqList)]
Definition Spinlock.hxx:747
xwer_t wait(sync::Cond &cond, xwtm_t to)
限时等待条件量
Definition Spinlock.hxx:843
CPU中断上锁模式下的自旋锁RAII机制守卫
Definition Spinlock.hxx:423
xwer_t wait(sync::Cond &cond)
等待条件量
Definition Spinlock.hxx:484
~LkThGrd()
析构自旋锁的RAII机制守卫
Definition Spinlock.cxx:146
xwer_t wait(sync::Cond &cond, xwtm_t to)
限时等待条件量
Definition Spinlock.hxx:522
xwer_t wait(sync::Cond *cond)
等待条件量
Definition Spinlock.cxx:156
enum LockStatus getStatus()
获取锁状态
Definition Spinlock.hxx:450
中断底半部尝试上锁模式下的自旋锁RAII机制守卫
Definition Spinlock.hxx:699
~TryLkBhGrd()
析构自旋锁的RAII机制守卫
Definition Spinlock.hxx:719
xwer_t getRc()
获取上锁结果错误码
Definition Spinlock.hxx:727
普通尝试上锁模式下的自旋锁RAII机制守卫
Definition Spinlock.hxx:381
~TryLkGrd()
析构自旋锁的RAII机制守卫
Definition Spinlock.hxx:401
xwer_t getRc()
获取上锁结果错误码
Definition Spinlock.hxx:409
部分中断尝试上锁模式下的自旋锁RAII机制守卫
Definition Spinlock.hxx:865
~TryLkIrqsGrd()
析构自旋锁的RAII机制守卫
Definition Spinlock.hxx:885
xwer_t getRc()
获取上锁结果错误码
Definition Spinlock.hxx:893
CPU中断尝试上锁模式下的自旋锁RAII机制守卫
Definition Spinlock.hxx:541
xwer_t getRc()
获取上锁结果错误码
Definition Spinlock.hxx:569
~TryLkThGrd()
析构自旋锁的RAII机制守卫
Definition Spinlock.hxx:561
struct xwos_splk mLock
Definition Spinlock.hxx:897
struct xwos_splk * getXwosObj()
Definition Spinlock.hxx:902
条件量基类
Definition Cond.hxx:31
xws64_t xwtm_t
XWOS系统时间 (有符号)
Definition type.h:742
signed long xwer_t
Definition type.h:554
signed int xwirq_t
Definition type.h:517
xwptr_t xwreg_t
Definition type.h:409
uint32_t xwu32_t
Definition type.h:266
Definition Cpu.hxx:19
C++操作系统抽象层:自旋锁
XWOS API:自旋锁
Definition spinlock.h:73