server_wrap_mt_common.h 61 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770
  1. /**************************************************************************/
  2. /* server_wrap_mt_common.h */
  3. /**************************************************************************/
  4. /* This file is part of: */
  5. /* GODOT ENGINE */
  6. /* https://godotengine.org */
  7. /**************************************************************************/
  8. /* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
  9. /* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
  10. /* */
  11. /* Permission is hereby granted, free of charge, to any person obtaining */
  12. /* a copy of this software and associated documentation files (the */
  13. /* "Software"), to deal in the Software without restriction, including */
  14. /* without limitation the rights to use, copy, modify, merge, publish, */
  15. /* distribute, sublicense, and/or sell copies of the Software, and to */
  16. /* permit persons to whom the Software is furnished to do so, subject to */
  17. /* the following conditions: */
  18. /* */
  19. /* The above copyright notice and this permission notice shall be */
  20. /* included in all copies or substantial portions of the Software. */
  21. /* */
  22. /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
  23. /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
  24. /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
  25. /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
  26. /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
  27. /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
  28. /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
  29. /**************************************************************************/
  30. #ifndef SERVER_WRAP_MT_COMMON_H
  31. #define SERVER_WRAP_MT_COMMON_H
  32. #define FUNC0R(m_r, m_type) \
  33. virtual m_r m_type() override { \
  34. if (Thread::get_caller_id() != server_thread) { \
  35. m_r ret; \
  36. command_queue.push_and_ret(server_name, &ServerName::m_type, &ret); \
  37. SYNC_DEBUG \
  38. return ret; \
  39. } else { \
  40. command_queue.flush_if_pending(); \
  41. return server_name->m_type(); \
  42. } \
  43. }
  44. #define FUNCRIDSPLIT(m_type) \
  45. virtual RID m_type##_create() override { \
  46. RID ret = server_name->m_type##_allocate(); \
  47. if (Thread::get_caller_id() != server_thread) { \
  48. command_queue.push(server_name, &ServerName::m_type##_initialize, ret); \
  49. } else { \
  50. server_name->m_type##_initialize(ret); \
  51. } \
  52. return ret; \
  53. }
  54. //RID now returns directly, ensure thread safety yourself
  55. #define FUNCRID(m_type) \
  56. virtual RID m_type##_create() override { \
  57. return server_name->m_type##_create(); \
  58. }
  59. #define FUNC0RC(m_r, m_type) \
  60. virtual m_r m_type() const override { \
  61. WRITE_ACTION \
  62. if (Thread::get_caller_id() != server_thread) { \
  63. m_r ret; \
  64. command_queue.push_and_ret(server_name, &ServerName::m_type, &ret); \
  65. SYNC_DEBUG \
  66. return ret; \
  67. } else { \
  68. command_queue.flush_if_pending(); \
  69. return server_name->m_type(); \
  70. } \
  71. }
  72. #define FUNC0(m_type) \
  73. virtual void m_type() override { \
  74. WRITE_ACTION \
  75. if (Thread::get_caller_id() != server_thread) { \
  76. command_queue.push(server_name, &ServerName::m_type); \
  77. } else { \
  78. command_queue.flush_if_pending(); \
  79. server_name->m_type(); \
  80. } \
  81. }
  82. #define FUNC0C(m_type) \
  83. virtual void m_type() const override { \
  84. if (Thread::get_caller_id() != server_thread) { \
  85. command_queue.push(server_name, &ServerName::m_type); \
  86. } else { \
  87. command_queue.flush_if_pending(); \
  88. server_name->m_type(); \
  89. } \
  90. }
  91. #define FUNC0S(m_type) \
  92. virtual void m_type() override { \
  93. WRITE_ACTION \
  94. if (Thread::get_caller_id() != server_thread) { \
  95. command_queue.push_and_sync(server_name, &ServerName::m_type); \
  96. SYNC_DEBUG \
  97. } else { \
  98. command_queue.flush_if_pending(); \
  99. server_name->m_type(); \
  100. } \
  101. }
  102. #define FUNC0SC(m_type) \
  103. virtual void m_type() const override { \
  104. if (Thread::get_caller_id() != server_thread) { \
  105. command_queue.push_and_sync(server_name, &ServerName::m_type); \
  106. SYNC_DEBUG \
  107. } else { \
  108. command_queue.flush_if_pending(); \
  109. server_name->m_type(); \
  110. } \
  111. }
  112. ///////////////////////////////////////////////
  113. #define FUNC1R(m_r, m_type, m_arg1) \
  114. virtual m_r m_type(m_arg1 p1) override { \
  115. WRITE_ACTION \
  116. if (Thread::get_caller_id() != server_thread) { \
  117. m_r ret; \
  118. command_queue.push_and_ret(server_name, &ServerName::m_type, p1, &ret); \
  119. SYNC_DEBUG \
  120. return ret; \
  121. } else { \
  122. command_queue.flush_if_pending(); \
  123. return server_name->m_type(p1); \
  124. } \
  125. }
  126. #define FUNC1RC(m_r, m_type, m_arg1) \
  127. virtual m_r m_type(m_arg1 p1) const override { \
  128. if (Thread::get_caller_id() != server_thread) { \
  129. m_r ret; \
  130. command_queue.push_and_ret(server_name, &ServerName::m_type, p1, &ret); \
  131. SYNC_DEBUG \
  132. return ret; \
  133. } else { \
  134. command_queue.flush_if_pending(); \
  135. return server_name->m_type(p1); \
  136. } \
  137. }
  138. #define FUNC1S(m_type, m_arg1) \
  139. virtual void m_type(m_arg1 p1) override { \
  140. WRITE_ACTION \
  141. if (Thread::get_caller_id() != server_thread) { \
  142. command_queue.push_and_sync(server_name, &ServerName::m_type, p1); \
  143. SYNC_DEBUG \
  144. } else { \
  145. command_queue.flush_if_pending(); \
  146. server_name->m_type(p1); \
  147. } \
  148. }
  149. #define FUNC1SC(m_type, m_arg1) \
  150. virtual void m_type(m_arg1 p1) const override { \
  151. if (Thread::get_caller_id() != server_thread) { \
  152. command_queue.push_and_sync(server_name, &ServerName::m_type, p1); \
  153. SYNC_DEBUG \
  154. } else { \
  155. command_queue.flush_if_pending(); \
  156. server_name->m_type(p1); \
  157. } \
  158. }
  159. #define FUNC1(m_type, m_arg1) \
  160. virtual void m_type(m_arg1 p1) override { \
  161. WRITE_ACTION \
  162. if (Thread::get_caller_id() != server_thread) { \
  163. command_queue.push(server_name, &ServerName::m_type, p1); \
  164. } else { \
  165. command_queue.flush_if_pending(); \
  166. server_name->m_type(p1); \
  167. } \
  168. }
  169. #define FUNC1C(m_type, m_arg1) \
  170. virtual void m_type(m_arg1 p1) const override { \
  171. if (Thread::get_caller_id() != server_thread) { \
  172. command_queue.push(server_name, &ServerName::m_type, p1); \
  173. } else { \
  174. command_queue.flush_if_pending(); \
  175. server_name->m_type(p1); \
  176. } \
  177. }
  178. #define FUNC2R(m_r, m_type, m_arg1, m_arg2) \
  179. virtual m_r m_type(m_arg1 p1, m_arg2 p2) override { \
  180. WRITE_ACTION \
  181. if (Thread::get_caller_id() != server_thread) { \
  182. m_r ret; \
  183. command_queue.push_and_ret(server_name, &ServerName::m_type, p1, p2, &ret); \
  184. SYNC_DEBUG \
  185. return ret; \
  186. } else { \
  187. command_queue.flush_if_pending(); \
  188. return server_name->m_type(p1, p2); \
  189. } \
  190. }
  191. #define FUNC2RC(m_r, m_type, m_arg1, m_arg2) \
  192. virtual m_r m_type(m_arg1 p1, m_arg2 p2) const override { \
  193. if (Thread::get_caller_id() != server_thread) { \
  194. m_r ret; \
  195. command_queue.push_and_ret(server_name, &ServerName::m_type, p1, p2, &ret); \
  196. SYNC_DEBUG \
  197. return ret; \
  198. } else { \
  199. command_queue.flush_if_pending(); \
  200. return server_name->m_type(p1, p2); \
  201. } \
  202. }
  203. #define FUNC2S(m_type, m_arg1, m_arg2) \
  204. virtual void m_type(m_arg1 p1, m_arg2 p2) override { \
  205. WRITE_ACTION \
  206. if (Thread::get_caller_id() != server_thread) { \
  207. command_queue.push_and_sync(server_name, &ServerName::m_type, p1, p2); \
  208. SYNC_DEBUG \
  209. } else { \
  210. command_queue.flush_if_pending(); \
  211. server_name->m_type(p1, p2); \
  212. } \
  213. }
  214. #define FUNC2SC(m_type, m_arg1, m_arg2) \
  215. virtual void m_type(m_arg1 p1, m_arg2 p2) const override { \
  216. if (Thread::get_caller_id() != server_thread) { \
  217. command_queue.push_and_sync(server_name, &ServerName::m_type, p1, p2); \
  218. SYNC_DEBUG \
  219. } else { \
  220. command_queue.flush_if_pending(); \
  221. server_name->m_type(p1, p2); \
  222. } \
  223. }
  224. #define FUNC2(m_type, m_arg1, m_arg2) \
  225. virtual void m_type(m_arg1 p1, m_arg2 p2) override { \
  226. WRITE_ACTION \
  227. if (Thread::get_caller_id() != server_thread) { \
  228. command_queue.push(server_name, &ServerName::m_type, p1, p2); \
  229. } else { \
  230. command_queue.flush_if_pending(); \
  231. server_name->m_type(p1, p2); \
  232. } \
  233. }
  234. #define FUNC2C(m_type, m_arg1, m_arg2) \
  235. virtual void m_type(m_arg1 p1, m_arg2 p2) const override { \
  236. if (Thread::get_caller_id() != server_thread) { \
  237. command_queue.push(server_name, &ServerName::m_type, p1, p2); \
  238. } else { \
  239. command_queue.flush_if_pending(); \
  240. server_name->m_type(p1, p2); \
  241. } \
  242. }
  243. #define FUNC3R(m_r, m_type, m_arg1, m_arg2, m_arg3) \
  244. virtual m_r m_type(m_arg1 p1, m_arg2 p2, m_arg3 p3) override { \
  245. WRITE_ACTION \
  246. if (Thread::get_caller_id() != server_thread) { \
  247. m_r ret; \
  248. command_queue.push_and_ret(server_name, &ServerName::m_type, p1, p2, p3, &ret); \
  249. SYNC_DEBUG \
  250. return ret; \
  251. } else { \
  252. command_queue.flush_if_pending(); \
  253. return server_name->m_type(p1, p2, p3); \
  254. } \
  255. }
  256. #define FUNC3RC(m_r, m_type, m_arg1, m_arg2, m_arg3) \
  257. virtual m_r m_type(m_arg1 p1, m_arg2 p2, m_arg3 p3) const override { \
  258. if (Thread::get_caller_id() != server_thread) { \
  259. m_r ret; \
  260. command_queue.push_and_ret(server_name, &ServerName::m_type, p1, p2, p3, &ret); \
  261. SYNC_DEBUG \
  262. return ret; \
  263. } else { \
  264. command_queue.flush_if_pending(); \
  265. return server_name->m_type(p1, p2, p3); \
  266. } \
  267. }
  268. #define FUNC3S(m_type, m_arg1, m_arg2, m_arg3) \
  269. virtual void m_type(m_arg1 p1, m_arg2 p2, m_arg3 p3) override { \
  270. WRITE_ACTION \
  271. if (Thread::get_caller_id() != server_thread) { \
  272. command_queue.push_and_sync(server_name, &ServerName::m_type, p1, p2, p3); \
  273. SYNC_DEBUG \
  274. } else { \
  275. command_queue.flush_if_pending(); \
  276. server_name->m_type(p1, p2, p3); \
  277. } \
  278. }
  279. #define FUNC3SC(m_type, m_arg1, m_arg2, m_arg3) \
  280. virtual void m_type(m_arg1 p1, m_arg2 p2, m_arg3 p3) const override { \
  281. if (Thread::get_caller_id() != server_thread) { \
  282. command_queue.push_and_sync(server_name, &ServerName::m_type, p1, p2, p3); \
  283. SYNC_DEBUG \
  284. } else { \
  285. command_queue.flush_if_pending(); \
  286. server_name->m_type(p1, p2, p3); \
  287. } \
  288. }
  289. #define FUNC3(m_type, m_arg1, m_arg2, m_arg3) \
  290. virtual void m_type(m_arg1 p1, m_arg2 p2, m_arg3 p3) override { \
  291. WRITE_ACTION \
  292. if (Thread::get_caller_id() != server_thread) { \
  293. command_queue.push(server_name, &ServerName::m_type, p1, p2, p3); \
  294. } else { \
  295. command_queue.flush_if_pending(); \
  296. server_name->m_type(p1, p2, p3); \
  297. } \
  298. }
  299. #define FUNC3C(m_type, m_arg1, m_arg2, m_arg3) \
  300. virtual void m_type(m_arg1 p1, m_arg2 p2, m_arg3 p3) const override { \
  301. if (Thread::get_caller_id() != server_thread) { \
  302. command_queue.push(server_name, &ServerName::m_type, p1, p2, p3); \
  303. } else { \
  304. command_queue.flush_if_pending(); \
  305. server_name->m_type(p1, p2, p3); \
  306. } \
  307. }
  308. #define FUNC4R(m_r, m_type, m_arg1, m_arg2, m_arg3, m_arg4) \
  309. virtual m_r m_type(m_arg1 p1, m_arg2 p2, m_arg3 p3, m_arg4 p4) override { \
  310. WRITE_ACTION \
  311. if (Thread::get_caller_id() != server_thread) { \
  312. m_r ret; \
  313. command_queue.push_and_ret(server_name, &ServerName::m_type, p1, p2, p3, p4, &ret); \
  314. SYNC_DEBUG \
  315. return ret; \
  316. } else { \
  317. command_queue.flush_if_pending(); \
  318. return server_name->m_type(p1, p2, p3, p4); \
  319. } \
  320. }
  321. #define FUNC4RC(m_r, m_type, m_arg1, m_arg2, m_arg3, m_arg4) \
  322. virtual m_r m_type(m_arg1 p1, m_arg2 p2, m_arg3 p3, m_arg4 p4) const override { \
  323. if (Thread::get_caller_id() != server_thread) { \
  324. m_r ret; \
  325. command_queue.push_and_ret(server_name, &ServerName::m_type, p1, p2, p3, p4, &ret); \
  326. SYNC_DEBUG \
  327. return ret; \
  328. } else { \
  329. command_queue.flush_if_pending(); \
  330. return server_name->m_type(p1, p2, p3, p4); \
  331. } \
  332. }
  333. #define FUNC4S(m_type, m_arg1, m_arg2, m_arg3, m_arg4) \
  334. virtual void m_type(m_arg1 p1, m_arg2 p2, m_arg3 p3, m_arg4 p4) override { \
  335. WRITE_ACTION \
  336. if (Thread::get_caller_id() != server_thread) { \
  337. command_queue.push_and_sync(server_name, &ServerName::m_type, p1, p2, p3, p4); \
  338. SYNC_DEBUG \
  339. } else { \
  340. command_queue.flush_if_pending(); \
  341. server_name->m_type(p1, p2, p3, p4); \
  342. } \
  343. }
  344. #define FUNC4SC(m_type, m_arg1, m_arg2, m_arg3, m_arg4) \
  345. virtual void m_type(m_arg1 p1, m_arg2 p2, m_arg3 p3, m_arg4 p4) const override { \
  346. if (Thread::get_caller_id() != server_thread) { \
  347. command_queue.push_and_sync(server_name, &ServerName::m_type, p1, p2, p3, p4); \
  348. SYNC_DEBUG \
  349. } else { \
  350. command_queue.flush_if_pending(); \
  351. server_name->m_type(p1, p2, p3, p4); \
  352. } \
  353. }
  354. #define FUNC4(m_type, m_arg1, m_arg2, m_arg3, m_arg4) \
  355. virtual void m_type(m_arg1 p1, m_arg2 p2, m_arg3 p3, m_arg4 p4) override { \
  356. WRITE_ACTION \
  357. if (Thread::get_caller_id() != server_thread) { \
  358. command_queue.push(server_name, &ServerName::m_type, p1, p2, p3, p4); \
  359. } else { \
  360. command_queue.flush_if_pending(); \
  361. server_name->m_type(p1, p2, p3, p4); \
  362. } \
  363. }
  364. #define FUNC4C(m_type, m_arg1, m_arg2, m_arg3, m_arg4) \
  365. virtual void m_type(m_arg1 p1, m_arg2 p2, m_arg3 p3, m_arg4 p4) const override { \
  366. if (Thread::get_caller_id() != server_thread) { \
  367. command_queue.push(server_name, &ServerName::m_type, p1, p2, p3, p4); \
  368. } else { \
  369. command_queue.flush_if_pending(); \
  370. server_name->m_type(p1, p2, p3, p4); \
  371. } \
  372. }
  373. #define FUNC5R(m_r, m_type, m_arg1, m_arg2, m_arg3, m_arg4, m_arg5) \
  374. virtual m_r m_type(m_arg1 p1, m_arg2 p2, m_arg3 p3, m_arg4 p4, m_arg5 p5) { \
  375. WRITE_ACTION \
  376. if (Thread::get_caller_id() != server_thread) { \
  377. m_r ret; \
  378. command_queue.push_and_ret(server_name, &ServerName::m_type, p1, p2, p3, p4, p5, &ret); \
  379. SYNC_DEBUG \
  380. return ret; \
  381. } else { \
  382. command_queue.flush_if_pending(); \
  383. return server_name->m_type(p1, p2, p3, p4, p5); \
  384. } \
  385. }
  386. #define FUNC5RC(m_r, m_type, m_arg1, m_arg2, m_arg3, m_arg4, m_arg5) \
  387. virtual m_r m_type(m_arg1 p1, m_arg2 p2, m_arg3 p3, m_arg4 p4, m_arg5 p5) const override { \
  388. if (Thread::get_caller_id() != server_thread) { \
  389. m_r ret; \
  390. command_queue.push_and_ret(server_name, &ServerName::m_type, p1, p2, p3, p4, p5, &ret); \
  391. SYNC_DEBUG \
  392. return ret; \
  393. } else { \
  394. command_queue.flush_if_pending(); \
  395. return server_name->m_type(p1, p2, p3, p4, p5); \
  396. } \
  397. }
  398. #define FUNC5S(m_type, m_arg1, m_arg2, m_arg3, m_arg4, m_arg5) \
  399. virtual void m_type(m_arg1 p1, m_arg2 p2, m_arg3 p3, m_arg4 p4, m_arg5 p5) override { \
  400. WRITE_ACTION \
  401. if (Thread::get_caller_id() != server_thread) { \
  402. command_queue.push_and_sync(server_name, &ServerName::m_type, p1, p2, p3, p4, p5); \
  403. SYNC_DEBUG \
  404. } else { \
  405. command_queue.flush_if_pending(); \
  406. server_name->m_type(p1, p2, p3, p4, p5); \
  407. } \
  408. }
  409. #define FUNC5SC(m_type, m_arg1, m_arg2, m_arg3, m_arg4, m_arg5) \
  410. virtual void m_type(m_arg1 p1, m_arg2 p2, m_arg3 p3, m_arg4 p4, m_arg5 p5) const override { \
  411. if (Thread::get_caller_id() != server_thread) { \
  412. command_queue.push_and_sync(server_name, &ServerName::m_type, p1, p2, p3, p4, p5); \
  413. SYNC_DEBUG \
  414. } else { \
  415. command_queue.flush_if_pending(); \
  416. server_name->m_type(p1, p2, p3, p4, p5); \
  417. } \
  418. }
  419. #define FUNC5(m_type, m_arg1, m_arg2, m_arg3, m_arg4, m_arg5) \
  420. virtual void m_type(m_arg1 p1, m_arg2 p2, m_arg3 p3, m_arg4 p4, m_arg5 p5) override { \
  421. WRITE_ACTION \
  422. if (Thread::get_caller_id() != server_thread) { \
  423. command_queue.push(server_name, &ServerName::m_type, p1, p2, p3, p4, p5); \
  424. } else { \
  425. command_queue.flush_if_pending(); \
  426. server_name->m_type(p1, p2, p3, p4, p5); \
  427. } \
  428. }
  429. #define FUNC5C(m_type, m_arg1, m_arg2, m_arg3, m_arg4, m_arg5) \
  430. virtual void m_type(m_arg1 p1, m_arg2 p2, m_arg3 p3, m_arg4 p4, m_arg5 p5) const override { \
  431. if (Thread::get_caller_id() != server_thread) { \
  432. command_queue.push(server_name, &ServerName::m_type, p1, p2, p3, p4, p5); \
  433. } else { \
  434. command_queue.flush_if_pending(); \
  435. server_name->m_type(p1, p2, p3, p4, p5); \
  436. } \
  437. }
  438. #define FUNC6R(m_r, m_type, m_arg1, m_arg2, m_arg3, m_arg4, m_arg5, m_arg6) \
  439. virtual m_r m_type(m_arg1 p1, m_arg2 p2, m_arg3 p3, m_arg4 p4, m_arg5 p5, m_arg6 p6) { \
  440. WRITE_ACTION \
  441. if (Thread::get_caller_id() != server_thread) { \
  442. m_r ret; \
  443. command_queue.push_and_ret(server_name, &ServerName::m_type, p1, p2, p3, p4, p5, p6, &ret); \
  444. SYNC_DEBUG \
  445. return ret; \
  446. } else { \
  447. command_queue.flush_if_pending(); \
  448. return server_name->m_type(p1, p2, p3, p4, p5, p6); \
  449. } \
  450. }
  451. #define FUNC6RC(m_r, m_type, m_arg1, m_arg2, m_arg3, m_arg4, m_arg5, m_arg6) \
  452. virtual m_r m_type(m_arg1 p1, m_arg2 p2, m_arg3 p3, m_arg4 p4, m_arg5 p5, m_arg6 p6) const override { \
  453. if (Thread::get_caller_id() != server_thread) { \
  454. m_r ret; \
  455. command_queue.push_and_ret(server_name, &ServerName::m_type, p1, p2, p3, p4, p5, p6, &ret); \
  456. SYNC_DEBUG \
  457. return ret; \
  458. } else { \
  459. command_queue.flush_if_pending(); \
  460. return server_name->m_type(p1, p2, p3, p4, p5, p6); \
  461. } \
  462. }
  463. #define FUNC6S(m_type, m_arg1, m_arg2, m_arg3, m_arg4, m_arg5, m_arg6) \
  464. virtual void m_type(m_arg1 p1, m_arg2 p2, m_arg3 p3, m_arg4 p4, m_arg5 p5, m_arg6 p6) override { \
  465. WRITE_ACTION \
  466. if (Thread::get_caller_id() != server_thread) { \
  467. command_queue.push_and_sync(server_name, &ServerName::m_type, p1, p2, p3, p4, p5, p6); \
  468. SYNC_DEBUG \
  469. } else { \
  470. command_queue.flush_if_pending(); \
  471. server_name->m_type(p1, p2, p3, p4, p5, p6); \
  472. } \
  473. }
  474. #define FUNC6SC(m_type, m_arg1, m_arg2, m_arg3, m_arg4, m_arg5, m_arg6) \
  475. virtual void m_type(m_arg1 p1, m_arg2 p2, m_arg3 p3, m_arg4 p4, m_arg5 p5, m_arg6 p6) const override { \
  476. if (Thread::get_caller_id() != server_thread) { \
  477. command_queue.push_and_sync(server_name, &ServerName::m_type, p1, p2, p3, p4, p5, p6); \
  478. SYNC_DEBUG \
  479. } else { \
  480. command_queue.flush_if_pending(); \
  481. server_name->m_type(p1, p2, p3, p4, p5, p6); \
  482. } \
  483. }
  484. #define FUNC6(m_type, m_arg1, m_arg2, m_arg3, m_arg4, m_arg5, m_arg6) \
  485. virtual void m_type(m_arg1 p1, m_arg2 p2, m_arg3 p3, m_arg4 p4, m_arg5 p5, m_arg6 p6) override { \
  486. WRITE_ACTION \
  487. if (Thread::get_caller_id() != server_thread) { \
  488. command_queue.push(server_name, &ServerName::m_type, p1, p2, p3, p4, p5, p6); \
  489. } else { \
  490. command_queue.flush_if_pending(); \
  491. server_name->m_type(p1, p2, p3, p4, p5, p6); \
  492. } \
  493. }
  494. #define FUNC6C(m_type, m_arg1, m_arg2, m_arg3, m_arg4, m_arg5, m_arg6) \
  495. virtual void m_type(m_arg1 p1, m_arg2 p2, m_arg3 p3, m_arg4 p4, m_arg5 p5, m_arg6 p6) const override { \
  496. if (Thread::get_caller_id() != server_thread) { \
  497. command_queue.push(server_name, &ServerName::m_type, p1, p2, p3, p4, p5, p6); \
  498. } else { \
  499. command_queue.flush_if_pending(); \
  500. server_name->m_type(p1, p2, p3, p4, p5, p6); \
  501. } \
  502. }
  503. #define FUNC7R(m_r, m_type, m_arg1, m_arg2, m_arg3, m_arg4, m_arg5, m_arg6, m_arg7) \
  504. virtual m_r m_type(m_arg1 p1, m_arg2 p2, m_arg3 p3, m_arg4 p4, m_arg5 p5, m_arg6 p6, m_arg7 p7) override { \
  505. WRITE_ACTION \
  506. if (Thread::get_caller_id() != server_thread) { \
  507. m_r ret; \
  508. command_queue.push_and_ret(server_name, &ServerName::m_type, p1, p2, p3, p4, p5, p6, p7, &ret); \
  509. SYNC_DEBUG \
  510. return ret; \
  511. } else { \
  512. command_queue.flush_if_pending(); \
  513. return server_name->m_type(p1, p2, p3, p4, p5, p6, p7); \
  514. } \
  515. }
  516. #define FUNC7RC(m_r, m_type, m_arg1, m_arg2, m_arg3, m_arg4, m_arg5, m_arg6, m_arg7) \
  517. virtual m_r m_type(m_arg1 p1, m_arg2 p2, m_arg3 p3, m_arg4 p4, m_arg5 p5, m_arg6 p6, m_arg7 p7) const override { \
  518. if (Thread::get_caller_id() != server_thread) { \
  519. m_r ret; \
  520. command_queue.push_and_ret(server_name, &ServerName::m_type, p1, p2, p3, p4, p5, p6, p7, &ret); \
  521. SYNC_DEBUG \
  522. return ret; \
  523. } else { \
  524. command_queue.flush_if_pending(); \
  525. return server_name->m_type(p1, p2, p3, p4, p5, p6, p7); \
  526. } \
  527. }
  528. #define FUNC7S(m_type, m_arg1, m_arg2, m_arg3, m_arg4, m_arg5, m_arg6, m_arg7) \
  529. virtual void m_type(m_arg1 p1, m_arg2 p2, m_arg3 p3, m_arg4 p4, m_arg5 p5, m_arg6 p6, m_arg7 p7) override { \
  530. WRITE_ACTION \
  531. if (Thread::get_caller_id() != server_thread) { \
  532. command_queue.push_and_sync(server_name, &ServerName::m_type, p1, p2, p3, p4, p5, p6, p7); \
  533. SYNC_DEBUG \
  534. } else { \
  535. command_queue.flush_if_pending(); \
  536. server_name->m_type(p1, p2, p3, p4, p5, p6, p7); \
  537. } \
  538. }
  539. #define FUNC7SC(m_type, m_arg1, m_arg2, m_arg3, m_arg4, m_arg5, m_arg6, m_arg7) \
  540. virtual void m_type(m_arg1 p1, m_arg2 p2, m_arg3 p3, m_arg4 p4, m_arg5 p5, m_arg6 p6, m_arg7 p7) const override { \
  541. if (Thread::get_caller_id() != server_thread) { \
  542. command_queue.push_and_sync(server_name, &ServerName::m_type, p1, p2, p3, p4, p5, p6, p7); \
  543. SYNC_DEBUG \
  544. } else { \
  545. command_queue.flush_if_pending(); \
  546. server_name->m_type(p1, p2, p3, p4, p5, p6, p7); \
  547. } \
  548. }
  549. #define FUNC7(m_type, m_arg1, m_arg2, m_arg3, m_arg4, m_arg5, m_arg6, m_arg7) \
  550. virtual void m_type(m_arg1 p1, m_arg2 p2, m_arg3 p3, m_arg4 p4, m_arg5 p5, m_arg6 p6, m_arg7 p7) override { \
  551. WRITE_ACTION \
  552. if (Thread::get_caller_id() != server_thread) { \
  553. command_queue.push(server_name, &ServerName::m_type, p1, p2, p3, p4, p5, p6, p7); \
  554. } else { \
  555. command_queue.flush_if_pending(); \
  556. server_name->m_type(p1, p2, p3, p4, p5, p6, p7); \
  557. } \
  558. }
  559. #define FUNC7C(m_type, m_arg1, m_arg2, m_arg3, m_arg4, m_arg5, m_arg6, m_arg7) \
  560. virtual void m_type(m_arg1 p1, m_arg2 p2, m_arg3 p3, m_arg4 p4, m_arg5 p5, m_arg6 p6, m_arg7 p7) const override { \
  561. if (Thread::get_caller_id() != server_thread) { \
  562. command_queue.push(server_name, &ServerName::m_type, p1, p2, p3, p4, p5, p6, p7); \
  563. } else { \
  564. command_queue.flush_if_pending(); \
  565. server_name->m_type(p1, p2, p3, p4, p5, p6, p7); \
  566. } \
  567. }
  568. #define FUNC8R(m_r, m_type, m_arg1, m_arg2, m_arg3, m_arg4, m_arg5, m_arg6, m_arg7, m_arg8) \
  569. virtual m_r m_type(m_arg1 p1, m_arg2 p2, m_arg3 p3, m_arg4 p4, m_arg5 p5, m_arg6 p6, m_arg7 p7, m_arg8 p8) override { \
  570. WRITE_ACTION \
  571. if (Thread::get_caller_id() != server_thread) { \
  572. m_r ret; \
  573. command_queue.push_and_ret(server_name, &ServerName::m_type, p1, p2, p3, p4, p5, p6, p7, p8, &ret); \
  574. SYNC_DEBUG \
  575. return ret; \
  576. } else { \
  577. command_queue.flush_if_pending(); \
  578. return server_name->m_type(p1, p2, p3, p4, p5, p6, p7, p8); \
  579. } \
  580. }
  581. #define FUNC8RC(m_r, m_type, m_arg1, m_arg2, m_arg3, m_arg4, m_arg5, m_arg6, m_arg7, m_arg8) \
  582. virtual m_r m_type(m_arg1 p1, m_arg2 p2, m_arg3 p3, m_arg4 p4, m_arg5 p5, m_arg6 p6, m_arg7 p7, m_arg8 p8) const override { \
  583. if (Thread::get_caller_id() != server_thread) { \
  584. m_r ret; \
  585. command_queue.push_and_ret(server_name, &ServerName::m_type, p1, p2, p3, p4, p5, p6, p7, p8, &ret); \
  586. SYNC_DEBUG \
  587. return ret; \
  588. } else { \
  589. command_queue.flush_if_pending(); \
  590. return server_name->m_type(p1, p2, p3, p4, p5, p6, p7, p8); \
  591. } \
  592. }
  593. #define FUNC8S(m_type, m_arg1, m_arg2, m_arg3, m_arg4, m_arg5, m_arg6, m_arg7, m_arg8) \
  594. virtual void m_type(m_arg1 p1, m_arg2 p2, m_arg3 p3, m_arg4 p4, m_arg5 p5, m_arg6 p6, m_arg7 p7, m_arg8 p8) override { \
  595. WRITE_ACTION \
  596. if (Thread::get_caller_id() != server_thread) { \
  597. command_queue.push_and_sync(server_name, &ServerName::m_type, p1, p2, p3, p4, p5, p6, p7, p8); \
  598. SYNC_DEBUG \
  599. } else { \
  600. command_queue.flush_if_pending(); \
  601. server_name->m_type(p1, p2, p3, p4, p5, p6, p7, p8); \
  602. } \
  603. }
  604. #define FUNC8SC(m_type, m_arg1, m_arg2, m_arg3, m_arg4, m_arg5, m_arg6, m_arg7, m_arg8) \
  605. virtual void m_type(m_arg1 p1, m_arg2 p2, m_arg3 p3, m_arg4 p4, m_arg5 p5, m_arg6 p6, m_arg7 p7, m_arg8 p8) const override { \
  606. if (Thread::get_caller_id() != server_thread) { \
  607. command_queue.push_and_sync(server_name, &ServerName::m_type, p1, p2, p3, p4, p5, p6, p7, p8); \
  608. SYNC_DEBUG \
  609. } else { \
  610. command_queue.flush_if_pending(); \
  611. server_name->m_type(p1, p2, p3, p4, p5, p6, p7, p8); \
  612. } \
  613. }
  614. #define FUNC8(m_type, m_arg1, m_arg2, m_arg3, m_arg4, m_arg5, m_arg6, m_arg7, m_arg8) \
  615. virtual void m_type(m_arg1 p1, m_arg2 p2, m_arg3 p3, m_arg4 p4, m_arg5 p5, m_arg6 p6, m_arg7 p7, m_arg8 p8) override { \
  616. WRITE_ACTION \
  617. if (Thread::get_caller_id() != server_thread) { \
  618. command_queue.push(server_name, &ServerName::m_type, p1, p2, p3, p4, p5, p6, p7, p8); \
  619. } else { \
  620. command_queue.flush_if_pending(); \
  621. server_name->m_type(p1, p2, p3, p4, p5, p6, p7, p8); \
  622. } \
  623. }
  624. #define FUNC8C(m_type, m_arg1, m_arg2, m_arg3, m_arg4, m_arg5, m_arg6, m_arg7, m_arg8) \
  625. virtual void m_type(m_arg1 p1, m_arg2 p2, m_arg3 p3, m_arg4 p4, m_arg5 p5, m_arg6 p6, m_arg7 p7, m_arg8 p8) const override { \
  626. if (Thread::get_caller_id() != server_thread) { \
  627. command_queue.push(server_name, &ServerName::m_type, p1, p2, p3, p4, p5, p6, p7, p8); \
  628. } else { \
  629. command_queue.flush_if_pending(); \
  630. server_name->m_type(p1, p2, p3, p4, p5, p6, p7, p8); \
  631. } \
  632. }
  633. #define FUNC9(m_type, m_arg1, m_arg2, m_arg3, m_arg4, m_arg5, m_arg6, m_arg7, m_arg8, m_arg9) \
  634. virtual void m_type(m_arg1 p1, m_arg2 p2, m_arg3 p3, m_arg4 p4, m_arg5 p5, m_arg6 p6, m_arg7 p7, m_arg8 p8, m_arg9 p9) override { \
  635. WRITE_ACTION \
  636. if (Thread::get_caller_id() != server_thread) { \
  637. command_queue.push(server_name, &ServerName::m_type, p1, p2, p3, p4, p5, p6, p7, p8, p9); \
  638. } else { \
  639. command_queue.flush_if_pending(); \
  640. server_name->m_type(p1, p2, p3, p4, p5, p6, p7, p8, p9); \
  641. } \
  642. }
  643. #define FUNC10(m_type, m_arg1, m_arg2, m_arg3, m_arg4, m_arg5, m_arg6, m_arg7, m_arg8, m_arg9, m_arg10) \
  644. virtual void m_type(m_arg1 p1, m_arg2 p2, m_arg3 p3, m_arg4 p4, m_arg5 p5, m_arg6 p6, m_arg7 p7, m_arg8 p8, m_arg9 p9, m_arg10 p10) override { \
  645. WRITE_ACTION \
  646. if (Thread::get_caller_id() != server_thread) { \
  647. command_queue.push(server_name, &ServerName::m_type, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10); \
  648. } else { \
  649. command_queue.flush_if_pending(); \
  650. server_name->m_type(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10); \
  651. } \
  652. }
  653. #define FUNC11(m_type, m_arg1, m_arg2, m_arg3, m_arg4, m_arg5, m_arg6, m_arg7, m_arg8, m_arg9, m_arg10, m_arg11) \
  654. virtual void m_type(m_arg1 p1, m_arg2 p2, m_arg3 p3, m_arg4 p4, m_arg5 p5, m_arg6 p6, m_arg7 p7, m_arg8 p8, m_arg9 p9, m_arg10 p10, m_arg11 p11) override { \
  655. WRITE_ACTION \
  656. if (Thread::get_caller_id() != server_thread) { \
  657. command_queue.push(server_name, &ServerName::m_type, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11); \
  658. } else { \
  659. command_queue.flush_if_pending(); \
  660. server_name->m_type(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11); \
  661. } \
  662. }
  663. #define FUNC12(m_type, m_arg1, m_arg2, m_arg3, m_arg4, m_arg5, m_arg6, m_arg7, m_arg8, m_arg9, m_arg10, m_arg11, m_arg12) \
  664. virtual void m_type(m_arg1 p1, m_arg2 p2, m_arg3 p3, m_arg4 p4, m_arg5 p5, m_arg6 p6, m_arg7 p7, m_arg8 p8, m_arg9 p9, m_arg10 p10, m_arg11 p11, m_arg12 p12) override { \
  665. WRITE_ACTION \
  666. if (Thread::get_caller_id() != server_thread) { \
  667. command_queue.push(server_name, &ServerName::m_type, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12); \
  668. } else { \
  669. command_queue.flush_if_pending(); \
  670. server_name->m_type(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12); \
  671. } \
  672. }
  673. #define FUNC13(m_type, m_arg1, m_arg2, m_arg3, m_arg4, m_arg5, m_arg6, m_arg7, m_arg8, m_arg9, m_arg10, m_arg11, m_arg12, m_arg13) \
  674. virtual void m_type(m_arg1 p1, m_arg2 p2, m_arg3 p3, m_arg4 p4, m_arg5 p5, m_arg6 p6, m_arg7 p7, m_arg8 p8, m_arg9 p9, m_arg10 p10, m_arg11 p11, m_arg12 p12, m_arg13 p13) override { \
  675. WRITE_ACTION \
  676. if (Thread::get_caller_id() != server_thread) { \
  677. command_queue.push(server_name, &ServerName::m_type, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13); \
  678. } else { \
  679. command_queue.flush_if_pending(); \
  680. server_name->m_type(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13); \
  681. } \
  682. }
  683. #define FUNC14(m_type, m_arg1, m_arg2, m_arg3, m_arg4, m_arg5, m_arg6, m_arg7, m_arg8, m_arg9, m_arg10, m_arg11, m_arg12, m_arg13, m_arg14) \
  684. virtual void m_type(m_arg1 p1, m_arg2 p2, m_arg3 p3, m_arg4 p4, m_arg5 p5, m_arg6 p6, m_arg7 p7, m_arg8 p8, m_arg9 p9, m_arg10 p10, m_arg11 p11, m_arg12 p12, m_arg13 p13, m_arg14 p14) override { \
  685. WRITE_ACTION \
  686. if (Thread::get_caller_id() != server_thread) { \
  687. command_queue.push(server_name, &ServerName::m_type, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14); \
  688. } else { \
  689. command_queue.flush_if_pending(); \
  690. server_name->m_type(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14); \
  691. } \
  692. }
  693. #define FUNC15(m_type, m_arg1, m_arg2, m_arg3, m_arg4, m_arg5, m_arg6, m_arg7, m_arg8, m_arg9, m_arg10, m_arg11, m_arg12, m_arg13, m_arg14, m_arg15) \
  694. virtual void m_type(m_arg1 p1, m_arg2 p2, m_arg3 p3, m_arg4 p4, m_arg5 p5, m_arg6 p6, m_arg7 p7, m_arg8 p8, m_arg9 p9, m_arg10 p10, m_arg11 p11, m_arg12 p12, m_arg13 p13, m_arg14 p14, m_arg15 p15) override { \
  695. WRITE_ACTION \
  696. if (Thread::get_caller_id() != server_thread) { \
  697. command_queue.push(server_name, &ServerName::m_type, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15); \
  698. } else { \
  699. command_queue.flush_if_pending(); \
  700. server_name->m_type(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15); \
  701. } \
  702. }
  703. #endif // SERVER_WRAP_MT_COMMON_H