XWOS API  4.0
XWOS C/C++ API参考手册
载入中...
搜索中...
未找到
Seqlock.hxx
浏览该文件的文档.
1
13#ifndef __xwos_cxx_lock_Seqlock_hxx__
14#define __xwos_cxx_lock_Seqlock_hxx__
15
18
19namespace xwos {
20namespace lock {
21
464{
465 public:
473 };
474
485 {
486 protected:
489
490 public:
495 RdexLkGrd(Seqlock * seqlock);
496
501 RdexLkGrd(Seqlock & seqlock);
502
506 ~RdexLkGrd();
507
511 enum LockStatus getStatus() { return mStatus; }
533 xwer_t wait(sync::Cond * cond);
534
544 xwer_t wait(sync::Cond & cond) { return wait(&cond); }
545
570 xwer_t wait(sync::Cond * cond, xwtm_t to);
571
582 xwer_t wait(sync::Cond & cond, xwtm_t to) { return wait(&cond, to); }
583
584 protected:
586 };
587
599 : public RdexLkGrd
600 {
601 private:
604 public:
609 TryRdexLkGrd(Seqlock * seqlock);
610
615 TryRdexLkGrd(Seqlock & seqlock);
616
621
628 xwer_t getRc() { return mRc; }
629 };
630
642 {
643 protected:
648 public:
653 RdexLkThGrd(Seqlock * seqlock);
654
659 RdexLkThGrd(Seqlock & seqlock);
660
664 ~RdexLkThGrd();
665
669 enum LockStatus getStatus() { return mStatus; }
670
692 xwer_t wait(sync::Cond * cond);
693
703 xwer_t wait(sync::Cond & cond) { return wait(&cond); }
704
729 xwer_t wait(sync::Cond * cond, xwtm_t to);
730
741 xwer_t wait(sync::Cond & cond, xwtm_t to) { return wait(&cond, to); }
742
743 protected:
745 };
746
759 : public RdexLkThGrd
760 {
761 private:
764 public:
769 TryRdexLkThGrd(Seqlock * seqlock);
770
775 TryRdexLkThGrd(Seqlock & seqlock);
776
781
788 xwer_t getRc() { return mRc; }
789 };
790
801 {
802 protected:
805
806 public:
811 RdexLkBhGrd(Seqlock * seqlock);
812
817 RdexLkBhGrd(Seqlock & seqlock);
818
822 ~RdexLkBhGrd();
823
827 enum LockStatus getStatus() { return mStatus; }
828
850 xwer_t wait(sync::Cond * cond);
851
861 xwer_t wait(sync::Cond & cond) { return wait(&cond); }
862
887 xwer_t wait(sync::Cond * cond, xwtm_t to);
888
899 xwer_t wait(sync::Cond & cond, xwtm_t to) { return wait(&cond, to); }
900
901 protected:
903 };
904
917 : public RdexLkBhGrd
918 {
919 private:
922 public:
927 TryRdexLkBhGrd(Seqlock * seqlock);
928
933 TryRdexLkBhGrd(Seqlock & seqlock);
934
939
946 xwer_t getRc() { return mRc; }
947 };
948
959 template<xwirq_t ... TIrqList>
961 {
962 protected:
965 xwirq_t mIrqs[sizeof...(TIrqList)];
966 xwreg_t mIrqFlags[sizeof...(TIrqList)];
967
968 public:
973 RdexLkIrqsGrd(Seqlock * seqlock);
974
979 RdexLkIrqsGrd(Seqlock & seqlock);
980
985
989 enum LockStatus getStatus() { return mStatus; }
990
1012 xwer_t wait(sync::Cond * cond);
1013
1023 xwer_t wait(sync::Cond & cond) { return wait(&cond); }
1024
1049 xwer_t wait(sync::Cond * cond, xwtm_t to);
1050
1061 xwer_t wait(sync::Cond & cond, xwtm_t to) { return wait(&cond, to); }
1062
1063 protected:
1065 };
1066
1079 template<xwirq_t ... TIrqList>
1081 : public RdexLkIrqsGrd<TIrqList ...>
1082 {
1083 private:
1086 public:
1091 TryRdexLkIrqsGrd(Seqlock * seqlock);
1092
1097 TryRdexLkIrqsGrd(Seqlock & seqlock);
1098
1103
1110 xwer_t getRc() { return mRc; }
1111 };
1112
1123 {
1124 protected:
1127
1128 public:
1133 WrLkGrd(Seqlock * seqlock);
1134
1139 WrLkGrd(Seqlock & seqlock);
1140
1144 ~WrLkGrd();
1145
1149 enum LockStatus getStatus() { return mStatus; }
1150
1172 xwer_t wait(sync::Cond * cond);
1173
1183 xwer_t wait(sync::Cond & cond) { return wait(&cond); }
1184
1209 xwer_t wait(sync::Cond * cond, xwtm_t to);
1210
1221 xwer_t wait(sync::Cond & cond, xwtm_t to) { return wait(&cond, to); }
1222
1223 protected:
1225 };
1226
1238 : public WrLkGrd
1239 {
1240 private:
1243 public:
1248 TryWrLkGrd(Seqlock * seqlock);
1249
1254 TryWrLkGrd(Seqlock & seqlock);
1255
1260
1267 xwer_t getRc() { return mRc; }
1268 };
1269
1281 {
1282 protected:
1287 public:
1292 WrLkThGrd(Seqlock * seqlock);
1293
1298 WrLkThGrd(Seqlock & seqlock);
1299
1303 ~WrLkThGrd();
1304
1308 enum LockStatus getStatus() { return mStatus; }
1309
1331 xwer_t wait(sync::Cond * cond);
1332
1342 xwer_t wait(sync::Cond & cond) { return wait(&cond); }
1343
1368 xwer_t wait(sync::Cond * cond, xwtm_t to);
1369
1380 xwer_t wait(sync::Cond & cond, xwtm_t to) { return wait(&cond, to); }
1381
1382 protected:
1384 };
1385
1398 : public WrLkThGrd
1399 {
1400 private:
1403 public:
1408 TryWrLkThGrd(Seqlock * seqlock);
1409
1414 TryWrLkThGrd(Seqlock & seqlock);
1415
1420
1427 xwer_t getRc() { return mRc; }
1428 };
1429
1440 {
1441 protected:
1444
1445 public:
1450 WrLkBhGrd(Seqlock * seqlock);
1451
1456 WrLkBhGrd(Seqlock & seqlock);
1457
1461 ~WrLkBhGrd();
1462
1466 enum LockStatus getStatus() { return mStatus; }
1467
1489 xwer_t wait(sync::Cond * cond);
1490
1500 xwer_t wait(sync::Cond & cond) { return wait(&cond); }
1501
1526 xwer_t wait(sync::Cond * cond, xwtm_t to);
1527
1538 xwer_t wait(sync::Cond & cond, xwtm_t to) { return wait(&cond, to); }
1539
1540 protected:
1542 };
1543
1556 : public WrLkBhGrd
1557 {
1558 private:
1561 public:
1566 TryWrLkBhGrd(Seqlock * seqlock);
1567
1572 TryWrLkBhGrd(Seqlock & seqlock);
1573
1578
1585 xwer_t getRc() { return mRc; }
1586 };
1587
1598 template<xwirq_t ... TIrqList>
1600 {
1601 protected:
1604 xwirq_t mIrqs[sizeof...(TIrqList)];
1605 xwreg_t mIrqFlags[sizeof...(TIrqList)];
1606
1607 public:
1612 WrLkIrqsGrd(Seqlock * seqlock);
1613
1618 WrLkIrqsGrd(Seqlock & seqlock);
1619
1623 ~WrLkIrqsGrd();
1624
1628 enum LockStatus getStatus() { return mStatus; }
1629
1651 xwer_t wait(sync::Cond * cond);
1652
1662 xwer_t wait(sync::Cond & cond) { return wait(&cond); }
1663
1688 xwer_t wait(sync::Cond * cond, xwtm_t to);
1689
1700 xwer_t wait(sync::Cond & cond, xwtm_t to) { return wait(&cond, to); }
1701
1702 protected:
1704 };
1705
1718 template<xwirq_t ... TIrqList>
1720 : public WrLkIrqsGrd<TIrqList ...>
1721 {
1722 private:
1725 public:
1730 TryWrLkIrqsGrd(Seqlock * seqlock);
1731
1736 TryWrLkIrqsGrd(Seqlock & seqlock);
1737
1742
1749 xwer_t getRc() { return mRc; }
1750 };
1751
1752 private:
1755 public:
1756 Seqlock();
1757 ~Seqlock();
1758 struct xwos_sqlk * getXwosObj() { return &mLock; }
1768 xwsq_t readBegin();
1769
1778 bool readRetry(xwsq_t start);
1779
1785 xwsq_t getSeq();
1786};
1787
1792} // namespace lock
1793} // namespace xwos
1794
1795#endif /* xwos/cxx/lock/Seqlock.hxx */
xwos::sync::Cond
独占读中断底半部上锁模式下的顺序锁RAII机制守卫
Definition Seqlock.hxx:801
xwer_t wait(sync::Cond &cond, xwtm_t to)
限时等待条件量
Definition Seqlock.hxx:899
xwer_t wait(sync::Cond *cond)
等待条件量
Definition Seqlock.cxx:257
enum LockStatus getStatus()
获取锁状态
Definition Seqlock.hxx:827
~RdexLkBhGrd()
析构顺序锁的RAII机制守卫
Definition Seqlock.cxx:247
xwer_t wait(sync::Cond &cond)
等待条件量
Definition Seqlock.hxx:861
独占读普通上锁模式下的顺序锁RAII机制守卫
Definition Seqlock.hxx:485
xwer_t wait(sync::Cond &cond, xwtm_t to)
限时等待条件量
Definition Seqlock.hxx:582
~RdexLkGrd()
析构顺序锁的RAII机制守卫
Definition Seqlock.cxx:39
xwer_t wait(sync::Cond &cond)
等待条件量
Definition Seqlock.hxx:544
enum LockStatus getStatus()
获取锁状态
Definition Seqlock.hxx:511
xwer_t wait(sync::Cond *cond)
等待条件量
Definition Seqlock.cxx:49
独占读部分中断上锁模式的顺序锁RAII机制守卫
Definition Seqlock.hxx:961
enum LockStatus getStatus()
获取锁状态
Definition Seqlock.hxx:989
xwer_t wait(sync::Cond &cond)
等待条件量
Definition Seqlock.hxx:1023
xwreg_t mIrqFlags[sizeof...(TIrqList)]
Definition Seqlock.hxx:966
xwer_t wait(sync::Cond *cond)
等待条件量
Definition Seqlock.cxx:370
xwer_t wait(sync::Cond &cond, xwtm_t to)
限时等待条件量
Definition Seqlock.hxx:1061
xwirq_t mIrqs[sizeof...(TIrqList)]
Definition Seqlock.hxx:965
~RdexLkIrqsGrd()
析构顺序锁的RAII机制守卫
Definition Seqlock.cxx:358
独占读CPU中断上锁模式下的顺序锁RAII机制守卫
Definition Seqlock.hxx:642
enum LockStatus getStatus()
获取锁状态
Definition Seqlock.hxx:669
xwer_t wait(sync::Cond &cond)
等待条件量
Definition Seqlock.hxx:703
xwer_t wait(sync::Cond *cond)
等待条件量
Definition Seqlock.cxx:153
~RdexLkThGrd()
析构顺序锁的RAII机制守卫
Definition Seqlock.cxx:143
xwer_t wait(sync::Cond &cond, xwtm_t to)
限时等待条件量
Definition Seqlock.hxx:741
独占读中断底半部尝试上锁模式下的顺序锁RAII机制守卫
Definition Seqlock.hxx:918
~TryRdexLkBhGrd()
析构顺序锁的RAII机制守卫
Definition Seqlock.hxx:938
xwer_t getRc()
获取上锁结果错误码
Definition Seqlock.hxx:946
独占读普通尝试上锁模式下的顺序锁RAII机制守卫
Definition Seqlock.hxx:600
~TryRdexLkGrd()
析构顺序锁的RAII机制守卫
Definition Seqlock.hxx:620
xwer_t getRc()
获取上锁结果错误码
Definition Seqlock.hxx:628
独占读部分中断尝试上锁模式下的顺序锁RAII机制守卫
Definition Seqlock.hxx:1082
~TryRdexLkIrqsGrd()
析构顺序锁的RAII机制守卫
Definition Seqlock.hxx:1102
xwer_t getRc()
获取上锁结果错误码
Definition Seqlock.hxx:1110
独占读CPU中断尝试上锁模式下的顺序锁RAII机制守卫
Definition Seqlock.hxx:760
xwer_t getRc()
获取上锁结果错误码
Definition Seqlock.hxx:788
~TryRdexLkThGrd()
析构顺序锁的RAII机制守卫
Definition Seqlock.hxx:780
独占写中断底半部尝试上锁模式下的顺序锁RAII机制守卫
Definition Seqlock.hxx:1557
~TryWrLkBhGrd()
析构顺序锁的RAII机制守卫
Definition Seqlock.hxx:1577
xwer_t getRc()
获取上锁结果错误码
Definition Seqlock.hxx:1585
独占写普通尝试上锁模式下的顺序锁RAII机制守卫
Definition Seqlock.hxx:1239
xwer_t getRc()
获取上锁结果错误码
Definition Seqlock.hxx:1267
~TryWrLkGrd()
析构顺序锁的RAII机制守卫
Definition Seqlock.hxx:1259
独占写部分中断尝试上锁模式下的顺序锁RAII机制守卫
Definition Seqlock.hxx:1721
~TryWrLkIrqsGrd()
析构顺序锁的RAII机制守卫
Definition Seqlock.hxx:1741
xwer_t getRc()
获取上锁结果错误码
Definition Seqlock.hxx:1749
独占写CPU中断尝试上锁模式下的顺序锁RAII机制守卫
Definition Seqlock.hxx:1399
~TryWrLkThGrd()
析构顺序锁的RAII机制守卫
Definition Seqlock.hxx:1419
xwer_t getRc()
获取上锁结果错误码
Definition Seqlock.hxx:1427
独占写中断底半部上锁模式下的顺序锁RAII机制守卫
Definition Seqlock.hxx:1440
xwer_t wait(sync::Cond &cond)
等待条件量
Definition Seqlock.hxx:1500
xwer_t wait(sync::Cond *cond)
等待条件量
Definition Seqlock.cxx:691
~WrLkBhGrd()
析构顺序锁的RAII机制守卫
Definition Seqlock.cxx:681
xwer_t wait(sync::Cond &cond, xwtm_t to)
限时等待条件量
Definition Seqlock.hxx:1538
enum LockStatus getStatus()
获取锁状态
Definition Seqlock.hxx:1466
独占写普通上锁模式下的顺序锁RAII机制守卫
Definition Seqlock.hxx:1123
enum LockStatus getStatus()
获取锁状态
Definition Seqlock.hxx:1149
xwer_t wait(sync::Cond *cond)
等待条件量
Definition Seqlock.cxx:483
xwer_t wait(sync::Cond &cond, xwtm_t to)
限时等待条件量
Definition Seqlock.hxx:1221
~WrLkGrd()
析构顺序锁的RAII机制守卫
Definition Seqlock.cxx:473
xwer_t wait(sync::Cond &cond)
等待条件量
Definition Seqlock.hxx:1183
独占写部分中断上锁模式的顺序锁RAII机制守卫
Definition Seqlock.hxx:1600
xwirq_t mIrqs[sizeof...(TIrqList)]
Definition Seqlock.hxx:1604
xwer_t wait(sync::Cond &cond)
等待条件量
Definition Seqlock.hxx:1662
xwreg_t mIrqFlags[sizeof...(TIrqList)]
Definition Seqlock.hxx:1605
xwer_t wait(sync::Cond &cond, xwtm_t to)
限时等待条件量
Definition Seqlock.hxx:1700
enum LockStatus getStatus()
获取锁状态
Definition Seqlock.hxx:1628
~WrLkIrqsGrd()
析构顺序锁的RAII机制守卫
Definition Seqlock.cxx:792
xwer_t wait(sync::Cond *cond)
等待条件量
Definition Seqlock.cxx:804
独占写CPU中断上锁模式下的顺序锁RAII机制守卫
Definition Seqlock.hxx:1281
enum LockStatus getStatus()
获取锁状态
Definition Seqlock.hxx:1308
xwer_t wait(sync::Cond &cond, xwtm_t to)
限时等待条件量
Definition Seqlock.hxx:1380
xwer_t wait(sync::Cond &cond)
等待条件量
Definition Seqlock.hxx:1342
~WrLkThGrd()
析构顺序锁的RAII机制守卫
Definition Seqlock.cxx:577
xwer_t wait(sync::Cond *cond)
等待条件量
Definition Seqlock.cxx:587
struct xwos_sqlk * getXwosObj()
Definition Seqlock.hxx:1758
xwsq_t readBegin()
开启共享读临界区
Definition Seqlock.cxx:896
xwsq_t getSeq()
获取顺序锁的顺序值
Definition Seqlock.cxx:906
struct xwos_sqlk mLock
Definition Seqlock.hxx:1753
bool readRetry(xwsq_t start)
关闭共享读临界区,并检查是否需要重试
Definition Seqlock.cxx:901
条件量基类
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
unsigned long xwsq_t
Definition type.h:445
xwptr_t xwreg_t
Definition type.h:409
uint32_t xwu32_t
Definition type.h:266
Definition Cpu.hxx:19
C++操作系统抽象层:顺序锁
XWOS API:顺序锁
Definition seqlock.h:112