2024年3月9日发(作者:)

64

65 public static void QueueOnMainThread(Action taction, object tparam)

66 {

67 QueueOnMainThread(taction, tparam, 0f);

68 }

69 public static void QueueOnMainThread(Action taction, object tparam, float time)

70 {

71 if (time != 0)

72 {

73 lock (Current._delayed)

74 {

75 Current._(new DelayedQueueItem { time = + time, action = taction, param = tparam });

76 }

77 }

78 else

79 {

80 lock (Current._actions)

81 {

82 Current._(new NoDelayedQueueItem { action = taction, param = tparam });

83 }

84 }

85 }

86

87 public static Thread RunAsync(Action a)

88 {

89 Initialize();

90 while (numThreads >= maxThreads)

91 {

92 (100);

93 }

94 ent(ref numThreads);

95 serWorkItem(RunAction, a);

96 return null;

97 }

98

99 private static void RunAction(object action)

100 {

101 try

102 {

103 ((Action)action)();

104 }

105 catch

106 {

107 }

108 finally

109 {

110 ent(ref numThreads);

111 }

112

113 }

114

115

116 void OnDisable()

117 {

118 if (_current == this)

119 {

120

121 _current = null;

122 }

123 }

124

125

126

127 // Use this for initialization

128 void Start()

129 {

130

131 }

132

133 List _currentActions = new List();

134

135 // Update is called once per frame

136 void Update()

137 {

138 if (_ > 0)

139 {

140 lock (_actions)

141 {

142 _();

143 _ge(_actions);

144 _();

145 }

146 for (int i = 0; i < _; i++)

147 {

本文发布于:2024-03-09,感谢您对本站的认可!
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:跳转调用线程主线

发布评论

评论列表(有0条评论)
    福州电脑网_福州电脑维修_福州电脑之家_福州iThome

    福州电脑网_福州电脑维修_福州电脑之家_福州iThome

    福州电脑维修网(fzithome.com)专业的电脑维修,笔记本维修,上门维修各种电脑,笔记本,平板等,快速上门.电脑知识频道内容覆盖:计算机资讯,电脑基础应用知识,各种电脑故障维修学习,电脑外设产品维修维护,病毒,软件,硬件,常识.