1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>Xenomai API: Real-time pod services.</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.5.6 -->
<div class="navigation" id="top">
<div class="tabs">
<ul>
<li><a href="main.html"><span>Main Page</span></a></li>
<li><a href="pages.html"><span>Related Pages</span></a></li>
<li><a href="modules.html"><span>Modules</span></a></li>
<li><a href="annotated.html"><span>Data Structures</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
<li><a href="examples.html"><span>Examples</span></a></li>
<li>
<form action="search.php" method="get">
<table cellspacing="0" cellpadding="0" border="0">
<tr>
<td><label> <u>S</u>earch for </label></td>
<td><input type="text" name="query" value="" size="20" accesskey="s"/></td>
</tr>
</table>
</form>
</li>
</ul>
</div>
</div>
<div class="contents">
<h1>Real-time pod services.<br>
<small>
[<a class="el" href="group__nucleus.html">Xenomai nucleus.</a>]</small>
</h1>
<p>
<div class="dynheader">
Collaboration diagram for Real-time pod services.:</div>
<div class="dynsection">
<center><table><tr><td><img src="group__pod.png" border="0" alt="" usemap="#group____pod_map">
<map name="group____pod_map">
<area shape="rect" href="group__nucleus.html" title="Xenomai nucleus." alt="" coords="5,5,141,32"></map></td></tr></table></center>
</div>
<hr><a name="_details"></a><h2>Detailed Description</h2>
Real-time pod services.
<p>
<table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Files</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">file </td><td class="memItemRight" valign="bottom"><a class="el" href="pod_8h.html">pod.h</a></td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Real-time pod interface header. <br></td></tr>
<p>
<tr><td class="memItemLeft" nowrap align="right" valign="top">file </td><td class="memItemRight" valign="bottom"><a class="el" href="pod_8c.html">pod.c</a></td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Real-time pod services. <br></td></tr>
<p>
<tr><td colspan="2"><br><h2>Data Structures</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">struct </td><td class="memItemRight" valign="bottom"><a class="el" href="structxnpod.html">xnpod</a></td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Real-time pod descriptor. <a href="structxnpod.html#_details">More...</a><br></td></tr>
<tr><td colspan="2"><br><h2>Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__pod.html#g167bb3b4251ac8b8a3e7f358d236908a">xnpod_init</a> (void)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Initialize the core pod. <a href="#g167bb3b4251ac8b8a3e7f358d236908a"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__pod.html#g10d3c13efa3ab06ac23017710b13314e">xnpod_enable_timesource</a> (void)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Activate the core time source. <a href="#g10d3c13efa3ab06ac23017710b13314e"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="group__pod.html#g179f47d6e98446843f059790112dcce3">xnpod_disable_timesource</a> (void)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Stop the core time source. <a href="#g179f47d6e98446843f059790112dcce3"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="group__pod.html#g824dc22468666c9f14da1842f0184b84">xnpod_shutdown</a> (int xtype)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Shutdown the current pod. <a href="#g824dc22468666c9f14da1842f0184b84"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__pod.html#gd71ebccc5b7b3d367f65127a8849c036">xnpod_init_thread</a> (struct xnthread *thread, const struct xnthread_init_attr *attr, struct xnsched_class *sched_class, const union xnsched_policy_param *sched_param)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Initialize a new thread. <a href="#gd71ebccc5b7b3d367f65127a8849c036"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__pod.html#gd322f6afd62430705486a9036d0b7d66">xnpod_start_thread</a> (xnthread_t *thread, const struct xnthread_start_attr *attr)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Initial start of a newly created thread. <a href="#gd322f6afd62430705486a9036d0b7d66"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="group__pod.html#gd86de7feeb37bbac6f6660916c3fe099">xnpod_stop_thread</a> (xnthread_t *thread)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Stop a thread. <a href="#gd86de7feeb37bbac6f6660916c3fe099"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="group__pod.html#g61624578d0f1979f1ca6a5e9e49a74a3">xnpod_restart_thread</a> (xnthread_t *thread)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Restart a thread. <a href="#g61624578d0f1979f1ca6a5e9e49a74a3"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="group__pod.html#gd2b761fb70cad30339f092edb4a89587">xnpod_delete_thread</a> (xnthread_t *thread)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Delete a thread. <a href="#gd2b761fb70cad30339f092edb4a89587"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="group__pod.html#g75278c2ac6f43741eca9cc1d60072eac">xnpod_abort_thread</a> (xnthread_t *thread)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Abort a thread. <a href="#g75278c2ac6f43741eca9cc1d60072eac"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">xnflags_t </td><td class="memItemRight" valign="bottom"><a class="el" href="group__pod.html#g629c06b152dabfdb679b6e49bd9f7734">xnpod_set_thread_mode</a> (xnthread_t *thread, xnflags_t clrmask, xnflags_t setmask)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Change a thread's control mode. <a href="#g629c06b152dabfdb679b6e49bd9f7734"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="group__pod.html#g767221cf87c198c5dc071e9f597dcb3a">xnpod_suspend_thread</a> (xnthread_t *thread, xnflags_t mask, xnticks_t timeout, xntmode_t timeout_mode, struct xnsynch *wchan)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Suspend a thread. <a href="#g767221cf87c198c5dc071e9f597dcb3a"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="group__pod.html#gc3a7bf9e973782a8cfd6495a1786e812">xnpod_resume_thread</a> (xnthread_t *thread, xnflags_t mask)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Resume a thread. <a href="#gc3a7bf9e973782a8cfd6495a1786e812"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__pod.html#ge5f0d19e7a499b9b262f68a43ab545dd">xnpod_unblock_thread</a> (xnthread_t *thread)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Unblock a thread. <a href="#ge5f0d19e7a499b9b262f68a43ab545dd"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__pod.html#g6d535ef9821e98fd7f257b50a3c8d595">xnpod_set_thread_schedparam</a> (struct xnthread *thread, struct xnsched_class *sched_class, const union xnsched_policy_param *sched_param)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Change the base scheduling parameters of a thread. <a href="#g6d535ef9821e98fd7f257b50a3c8d595"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__pod.html#g4d14486d26a32a2660697f5a88d8301d">xnpod_migrate_thread</a> (int cpu)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Migrate the current thread. <a href="#g4d14486d26a32a2660697f5a88d8301d"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="group__pod.html#gfd49fb1aa94c5f44f8c23d66a77b5581">xnpod_dispatch_signals</a> (void)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Deliver pending asynchronous signals to the running thread. <a href="#gfd49fb1aa94c5f44f8c23d66a77b5581"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">static void </td><td class="memItemRight" valign="bottom"><a class="el" href="group__pod.html#gcf5b53f0405351327b89b0cc4976b962">xnpod_schedule</a> (void)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Rescheduling procedure entry point. <a href="#gcf5b53f0405351327b89b0cc4976b962"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__pod.html#ged5776a428e7c59b52b1da76f0d765fa">xnpod_set_thread_periodic</a> (xnthread_t *thread, xnticks_t idate, xnticks_t period)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Make a thread periodic. <a href="#ged5776a428e7c59b52b1da76f0d765fa"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__pod.html#gf836996e4a3378928f2a9f93a4915cfa">xnpod_wait_thread_period</a> (unsigned long *overruns_r)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Wait for the next periodic release point. <a href="#gf836996e4a3378928f2a9f93a4915cfa"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__pod.html#g4b8647e7a6969962c788669ff8d46d3b">xnpod_set_thread_tslice</a> (struct xnthread *thread, xnticks_t quantum)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Set thread time-slicing information. <a href="#g4b8647e7a6969962c788669ff8d46d3b"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__pod.html#g96e6b70fb05da3603bebacde76b16f22">xnpod_add_hook</a> (int type, void(*routine)(xnthread_t *))</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Install a nucleus hook. <a href="#g96e6b70fb05da3603bebacde76b16f22"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__pod.html#gce800481d23255eebe45f969e9434adf">xnpod_remove_hook</a> (int type, void(*routine)(xnthread_t *))</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Remove a nucleus hook. <a href="#gce800481d23255eebe45f969e9434adf"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="group__pod.html#g657259b9accb3be41574f9970baef393">xnpod_welcome_thread</a> (xnthread_t *thread, int imask)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Thread prologue. <a href="#g657259b9accb3be41574f9970baef393"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__pod.html#gf95cac21ec23e44282461905dd3fc153">xnpod_trap_fault</a> (xnarch_fltinfo_t *fltinfo)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Default fault handler. <a href="#gf95cac21ec23e44282461905dd3fc153"></a><br></td></tr>
</table>
<hr><h2>Function Documentation</h2>
<a class="anchor" name="g75278c2ac6f43741eca9cc1d60072eac"></a><!-- doxytag: member="pod.h::xnpod_abort_thread" ref="g75278c2ac6f43741eca9cc1d60072eac" args="(xnthread_t *thread)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void xnpod_abort_thread </td>
<td>(</td>
<td class="paramtype">xnthread_t * </td>
<td class="paramname"> <em>thread</em> </td>
<td> ) </td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Abort a thread.
<p>
Unconditionally terminates a thread and releases all the nucleus resources it currently holds, regardless of whether the target thread is currently active in kernel or user-space. <a class="el" href="group__pod.html#g75278c2ac6f43741eca9cc1d60072eac" title="Abort a thread.">xnpod_abort_thread()</a> should be reserved for use by skin cleanup routines; <a class="el" href="group__pod.html#gd2b761fb70cad30339f092edb4a89587" title="Delete a thread.">xnpod_delete_thread()</a> should be preferred as the common method for removing threads from a running system.<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>thread</em> </td><td>The descriptor address of the terminated thread.</td></tr>
</table>
</dl>
This service forces a call to <a class="el" href="group__pod.html#gd2b761fb70cad30339f092edb4a89587" title="Delete a thread.">xnpod_delete_thread()</a> for the target thread.<p>
Environments:<p>
This service can be called from:<p>
<ul>
<li>Kernel module initialization/cleanup code</li><li>Kernel-based task</li><li>User-space task</li></ul>
<p>
Rescheduling: possible if the current thread self-deletes.
<p>References <a class="el" href="include_2nucleus_2thread_8h-source.html#l00117">XNABORT</a>, <a class="el" href="include_2nucleus_2thread_8h-source.html#l00039">XNDORMANT</a>, <a class="el" href="pod_8c-source.html#l01078">xnpod_delete_thread()</a>, and <a class="el" href="pod_8c-source.html#l01361">xnpod_suspend_thread()</a>.</p>
</div>
</div><p>
<a class="anchor" name="g96e6b70fb05da3603bebacde76b16f22"></a><!-- doxytag: member="pod.h::xnpod_add_hook" ref="g96e6b70fb05da3603bebacde76b16f22" args="(int type, void(*routine)(xnthread_t *))" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int xnpod_add_hook </td>
<td>(</td>
<td class="paramtype">int </td>
<td class="paramname"> <em>type</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">void(*)(xnthread_t *) </td>
<td class="paramname"> <em>routine</em></td><td> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Install a nucleus hook.
<p>
The nucleus allows to register user-defined routines which get called whenever a specific scheduling event occurs. Multiple hooks can be chained for a single event type, and get called on a FIFO basis.<p>
The scheduling is locked while a hook is executing.<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>type</em> </td><td>Defines the kind of hook to install:</td></tr>
</table>
</dl>
<ul>
<li>XNHOOK_THREAD_START: The user-defined routine will be called on behalf of the starter thread whenever a new thread starts. The descriptor address of the started thread is passed to the routine.</li></ul>
<p>
<ul>
<li>XNHOOK_THREAD_DELETE: The user-defined routine will be called on behalf of the deletor thread whenever a thread is deleted. The descriptor address of the deleted thread is passed to the routine.</li></ul>
<p>
<ul>
<li>XNHOOK_THREAD_SWITCH: The user-defined routine will be called on behalf of the resuming thread whenever a context switch takes place. The descriptor address of the thread which has been switched out is passed to the routine.</li></ul>
<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>routine</em> </td><td>The address of the user-supplied routine to call.</td></tr>
</table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>0 is returned on success. Otherwise, one of the following error codes indicates the cause of the failure:</dd></dl>
<ul>
<li>-EINVAL is returned if type is incorrect.</li></ul>
<p>
<ul>
<li>-ENOMEM is returned if not enough memory is available from the system heap to add the new hook.</li></ul>
<p>
Environments:<p>
This service can be called from:<p>
<ul>
<li>Kernel module initialization/cleanup code</li><li>Kernel-based task</li><li>User-space task</li></ul>
<p>
Rescheduling: never.
<p>Referenced by <a class="el" href="ksrc_2skins_2native_2task_8c-source.html#l01222">rt_task_add_hook()</a>.</p>
</div>
</div><p>
<a class="anchor" name="gd2b761fb70cad30339f092edb4a89587"></a><!-- doxytag: member="pod.h::xnpod_delete_thread" ref="gd2b761fb70cad30339f092edb4a89587" args="(xnthread_t *thread)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void xnpod_delete_thread </td>
<td>(</td>
<td class="paramtype">xnthread_t * </td>
<td class="paramname"> <em>thread</em> </td>
<td> ) </td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Delete a thread.
<p>
Terminates a thread and releases all the nucleus resources it currently holds. A thread exists in the system since <a class="el" href="group__pod.html#gd71ebccc5b7b3d367f65127a8849c036" title="Initialize a new thread.">xnpod_init_thread()</a> has been called to create it, so this service must be called in order to destroy it afterwards.<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>thread</em> </td><td>The descriptor address of the terminated thread.</td></tr>
</table>
</dl>
The target thread's resources may not be immediately removed if this is an active shadow thread running in user-space. In such a case, the mated Linux task is sent a termination signal instead, and the actual deletion is deferred until the task exit event is called.<p>
The DELETE hooks are called on behalf of the calling context (if any). The information stored in the thread control block remains valid until all hooks have been called.<p>
Self-terminating a thread is allowed. In such a case, this service does not return to the caller.<p>
Environments:<p>
This service can be called from:<p>
<ul>
<li>Kernel module initialization/cleanup code</li><li>Kernel-based task</li><li>User-space task</li></ul>
<p>
Rescheduling: possible if the current thread self-deletes.
<p>References <a class="el" href="sched_8h-source.html#l00064">xnsched::curr</a>, <a class="el" href="sched_8h-source.html#l00062">xnsched::status</a>, <a class="el" href="include_2nucleus_2thread_8h-source.html#l00117">XNABORT</a>, <a class="el" href="include_2nucleus_2thread_8h-source.html#l00118">XNCANPND</a>, <a class="el" href="include_2nucleus_2thread_8h-source.html#l00053">XNDEFCAN</a>, <a class="el" href="include_2nucleus_2thread_8h-source.html#l00039">XNDORMANT</a>, <a class="el" href="include_2nucleus_2thread_8h-source.html#l00045">XNMIGRATE</a>, <a class="el" href="include_2nucleus_2thread_8h-source.html#l00036">XNPEND</a>, <a class="el" href="pod_8h-source.html#l00251">xnpod_schedule()</a>, <a class="el" href="pod_8c-source.html#l01713">xnpod_unblock_thread()</a>, <a class="el" href="include_2nucleus_2thread_8h-source.html#l00038">XNREADY</a>, <a class="el" href="include_2nucleus_2thread_8h-source.html#l00064">XNROOT</a>, <a class="el" href="select_8c-source.html#l00401">xnselector_destroy()</a>, <a class="el" href="synch_8c-source.html#l00900">xnsynch_forget_sleeper()</a>, <a class="el" href="synch_8c-source.html#l00960">xnsynch_release_all_ownerships()</a>, <a class="el" href="ksrc_2nucleus_2timer_8c-source.html#l00903">xntimer_destroy()</a>, and <a class="el" href="include_2nucleus_2thread_8h-source.html#l00040">XNZOMBIE</a>.</p>
<p>Referenced by <a class="el" href="ksrc_2skins_2native_2task_8c-source.html#l00249">rt_task_create()</a>, <a class="el" href="ksrc_2skins_2native_2task_8c-source.html#l00593">rt_task_delete()</a>, <a class="el" href="drvlib_8c-source.html#l00139">rtdm_task_init()</a>, <a class="el" href="pod_8c-source.html#l01273">xnpod_abort_thread()</a>, and <a class="el" href="pod_8c-source.html#l00461">xnpod_shutdown()</a>.</p>
</div>
</div><p>
<a class="anchor" name="g179f47d6e98446843f059790112dcce3"></a><!-- doxytag: member="pod.h::xnpod_disable_timesource" ref="g179f47d6e98446843f059790112dcce3" args="(void)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void xnpod_disable_timesource </td>
<td>(</td>
<td class="paramtype">void </td>
<td class="paramname"> </td>
<td> ) </td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Stop the core time source.
<p>
Releases the hardware timer, and deactivates the master time base.<p>
Environments:<p>
This service can be called from:<p>
<ul>
<li>Kernel module initialization/cleanup code</li><li>User-space task in secondary mode</li></ul>
<p>
Rescheduling: never.
<p>References <a class="el" href="ksrc_2nucleus_2timer_8c-source.html#l01037">xntimer_freeze()</a>.</p>
<p>Referenced by <a class="el" href="pod_8c-source.html#l00461">xnpod_shutdown()</a>.</p>
</div>
</div><p>
<a class="anchor" name="gfd49fb1aa94c5f44f8c23d66a77b5581"></a><!-- doxytag: member="pod.h::xnpod_dispatch_signals" ref="gfd49fb1aa94c5f44f8c23d66a77b5581" args="(void)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void xnpod_dispatch_signals </td>
<td>(</td>
<td class="paramtype">void </td>
<td class="paramname"> </td>
<td> ) </td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Deliver pending asynchronous signals to the running thread.
<p>
<p><b>For internal use only.</b></p>
<p>
This internal routine checks for the presence of asynchronous signals directed to the running thread, and attempts to start the asynchronous service routine (ASR) if any. Called with nklock locked, interrupts off. </p>
<p>References <a class="el" href="include_2nucleus_2thread_8h-source.html#l00052">XNASDI</a>.</p>
<p>Referenced by <a class="el" href="pod_8c-source.html#l02036">xnpod_welcome_thread()</a>, and <a class="el" href="shadow_8c-source.html#l00995">xnshadow_harden()</a>.</p>
</div>
</div><p>
<a class="anchor" name="g10d3c13efa3ab06ac23017710b13314e"></a><!-- doxytag: member="pod.h::xnpod_enable_timesource" ref="g10d3c13efa3ab06ac23017710b13314e" args="(void)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int xnpod_enable_timesource </td>
<td>(</td>
<td class="paramtype">void </td>
<td class="paramname"> </td>
<td> ) </td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Activate the core time source.
<p>
Xenomai implements the notion of time base, by which software timers that belong to different skins may be clocked separately according to distinct frequencies, or aperiodically. In the periodic case, delays and timeouts are given in counts of ticks; the duration of a tick is specified by the time base. In the aperiodic case, timings are directly specified in nanoseconds.<p>
Only a single aperiodic (i.e. tick-less) time base may exist in the system, and the nucleus provides for it through the nktbase object. All skins depending on aperiodic timings should bind to the latter, also known as the master time base. Skins depending on periodic timings may create and bind to their own time base. Such a periodic time base is managed as a slave object of the master one. A cascading software timer, which is fired by the master time base according to the appropriate frequency, triggers in turn the update process of the associated slave time base, which eventually fires the elapsed software timers controlled by the latter.<p>
Xenomai always controls the underlying hardware timer in a tick-less fashion, also known as the oneshot mode. The <a class="el" href="group__pod.html#g10d3c13efa3ab06ac23017710b13314e" title="Activate the core time source.">xnpod_enable_timesource()</a> service configures the timer chip as needed, and activates the master time base.<p>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>0 is returned on success. Otherwise:</dd></dl>
<ul>
<li>-ENODEV is returned if a failure occurred while configuring the hardware timer.</li></ul>
<p>
<ul>
<li>-ENOSYS is returned if no active pod exists.</li></ul>
<p>
Side-effect: A host timing service is started in order to relay the canonical periodical tick to the underlying architecture, regardless of the frequency used for Xenomai's system tick. This routine does not call the rescheduling procedure.<p>
Environments:<p>
This service can be called from:<p>
<ul>
<li>Kernel module initialization/cleanup code</li><li>User-space task in secondary mode</li></ul>
<p>
Rescheduling: never.<p>
<dl class="note" compact><dt><b>Note:</b></dt><dd>Built-in support for periodic timing depends on CONFIG_XENO_OPT_TIMING_PERIODIC. </dd></dl>
<p>References <a class="el" href="sched_8h-source.html#l00077">xnsched::htimer</a>, <a class="el" href="ksrc_2nucleus_2intr_8c-source.html#l00614">xnintr_init()</a>, and <a class="el" href="include_2nucleus_2timer_8h-source.html#l00473">xntimer_start()</a>.</p>
<p>Referenced by <a class="el" href="pod_8c-source.html#l00339">xnpod_init()</a>.</p>
</div>
</div><p>
<a class="anchor" name="g167bb3b4251ac8b8a3e7f358d236908a"></a><!-- doxytag: member="pod.h::xnpod_init" ref="g167bb3b4251ac8b8a3e7f358d236908a" args="(void)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int xnpod_init </td>
<td>(</td>
<td class="paramtype">void </td>
<td class="paramname"> </td>
<td> ) </td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Initialize the core pod.
<p>
Initializes the core interface pod which can subsequently be used to start real-time activities. Once the core pod is active, real-time skins can be stacked over. There can only be a single core pod active in the host environment. Such environment can be confined to a process (e.g. simulator), or expand machine-wide (e.g. I-pipe).<p>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>0 is returned on success. Otherwise:</dd></dl>
<ul>
<li>-ENOMEM is returned if the memory manager fails to initialize.</li></ul>
<p>
Environments:<p>
This service can be called from:<p>
<ul>
<li>Kernel module initialization code </li></ul>
<p>References <a class="el" href="pod_8h-source.html#l00085">xnpod::refcnt</a>, <a class="el" href="sched_8h-source.html#l00079">xnsched::rootcb</a>, <a class="el" href="pod_8h-source.html#l00071">xnpod::sched</a>, <a class="el" href="pod_8h-source.html#l00069">xnpod::status</a>, <a class="el" href="pod_8h-source.html#l00076">xnpod::tdeleteq</a>, <a class="el" href="pod_8h-source.html#l00073">xnpod::threadq</a>, <a class="el" href="pod_8h-source.html#l00080">xnpod::timerlck</a>, <a class="el" href="pod_8h-source.html#l00083">xnpod::tsliced</a>, <a class="el" href="pod_8h-source.html#l00082">xnpod::tslicer</a>, <a class="el" href="pod_8h-source.html#l00076">xnpod::tstartq</a>, <a class="el" href="pod_8h-source.html#l00076">xnpod::tswitchq</a>, <a class="el" href="ksrc_2nucleus_2heap_8c-source.html#l00317">xnheap_destroy()</a>, <a class="el" href="ksrc_2nucleus_2heap_8c-source.html#l00167">xnheap_init()</a>, <a class="el" href="ksrc_2nucleus_2heap_8c-source.html#l00276">xnheap_set_label()</a>, <a class="el" href="pod_8c-source.html#l02669">xnpod_enable_timesource()</a>, <a class="el" href="pod_8c-source.html#l00461">xnpod_shutdown()</a>, and <a class="el" href="group__timer.html#g834e46fb4c1ecaab949eea77b9dee284">xntimer_init()</a>.</p>
</div>
</div><p>
<a class="anchor" name="gd71ebccc5b7b3d367f65127a8849c036"></a><!-- doxytag: member="pod.h::xnpod_init_thread" ref="gd71ebccc5b7b3d367f65127a8849c036" args="(struct xnthread *thread, const struct xnthread_init_attr *attr, struct xnsched_class *sched_class, const union xnsched_policy_param *sched_param)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int xnpod_init_thread </td>
<td>(</td>
<td class="paramtype">struct xnthread * </td>
<td class="paramname"> <em>thread</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const struct xnthread_init_attr * </td>
<td class="paramname"> <em>attr</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">struct xnsched_class * </td>
<td class="paramname"> <em>sched_class</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const union xnsched_policy_param * </td>
<td class="paramname"> <em>sched_param</em></td><td> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Initialize a new thread.
<p>
Initializes a new thread attached to the active pod. The thread is left in an innocuous state until it is actually started by <a class="el" href="group__pod.html#gd322f6afd62430705486a9036d0b7d66" title="Initial start of a newly created thread.">xnpod_start_thread()</a>.<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>thread</em> </td><td>The address of a thread descriptor the nucleus will use to store the thread-specific data. This descriptor must always be valid while the thread is active therefore it must be allocated in permanent memory. </td></tr>
</table>
</dl>
<dl class="warning" compact><dt><b>Warning:</b></dt><dd>Some architectures may require the descriptor to be properly aligned in memory; this is an additional reason for descriptors not to be laid in the program stack where alignement constraints might not always be satisfied.</dd></dl>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>attr</em> </td><td>A pointer to an attribute block describing the initial properties of the new thread. Members of this structure are defined as follows:</td></tr>
</table>
</dl>
<ul>
<li>name: An ASCII string standing for the symbolic name of the thread. This name is copied to a safe place into the thread descriptor. This name might be used in various situations by the nucleus for issuing human-readable diagnostic messages, so it is usually a good idea to provide a sensible value here. The simulator even uses this name intensively to identify threads in the debugging GUI it provides. However, passing NULL here is always legal and means "anonymous".</li></ul>
<p>
<ul>
<li>tbase: The time base descriptor to refer to for all timed operations issued by the new thread. See <a class="el" href="group__timebase.html#gfcb0a76ac26eaaa768db89cb54e3f24a" title="Allocate a time base.">xntbase_alloc()</a> for detailed explanations about time bases.</li></ul>
<p>
<ul>
<li>flags: A set of creation flags affecting the operation. The following flags can be part of this bitmask, each of them affecting the nucleus behaviour regarding the created thread:</li></ul>
<p>
<ul>
<li>XNSUSP creates the thread in a suspended state. In such a case, the thread will have to be explicitly resumed using the <a class="el" href="group__pod.html#gc3a7bf9e973782a8cfd6495a1786e812" title="Resume a thread.">xnpod_resume_thread()</a> service for its execution to actually begin, additionally to issuing <a class="el" href="group__pod.html#gd322f6afd62430705486a9036d0b7d66" title="Initial start of a newly created thread.">xnpod_start_thread()</a> for it. This flag can also be specified when invoking <a class="el" href="group__pod.html#gd322f6afd62430705486a9036d0b7d66" title="Initial start of a newly created thread.">xnpod_start_thread()</a> as a starting mode.</li></ul>
<p>
<ul>
<li>XNFPU (enable FPU) tells the nucleus that the new thread will use the floating-point unit. In such a case, the nucleus will handle the FPU context save/restore ops upon thread switches at the expense of a few additional cycles per context switch. By default, a thread is not expected to use the FPU. This flag is simply ignored when the nucleus runs on behalf of a userspace-based real-time control layer since the FPU management is always active if present.</li></ul>
<p>
<ul>
<li>stacksize: The size of the stack (in bytes) for the new thread. If zero is passed, the nucleus will use a reasonable pre-defined size depending on the underlying real-time control layer.</li></ul>
<p>
<ul>
<li>ops: A pointer to a structure defining the class-level operations available for this thread. Fields from this structure must have been set appropriately by the caller.</li></ul>
<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>sched_class</em> </td><td>The initial scheduling class the new thread should be assigned to.</td></tr>
<tr><td valign="top"></td><td valign="top"><em>sched_param</em> </td><td>The initial scheduling parameters to set for the new thread; <em>sched_param</em> must be valid within the context of <em>sched_class</em>.</td></tr>
</table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>0 is returned on success. Otherwise, one of the following error codes indicates the cause of the failure:</dd></dl>
<ul>
<li>-EINVAL is returned if <em>attr->flags</em> has invalid bits set.</li></ul>
<p>
<ul>
<li>-ENOMEM is returned if not enough memory is available from the system heap to create the new thread's stack.</li></ul>
<p>
Side-effect: This routine does not call the rescheduling procedure.<p>
Environments:<p>
This service can be called from:<p>
<ul>
<li>Kernel module initialization/cleanup code</li><li>Kernel-based task</li><li>User-space task</li></ul>
<p>
Rescheduling: never.
<p>References <a class="el" href="include_2nucleus_2thread_8h-source.html#l00039">XNDORMANT</a>, <a class="el" href="include_2nucleus_2thread_8h-source.html#l00062">XNFPU</a>, <a class="el" href="pod_8c-source.html#l01361">xnpod_suspend_thread()</a>, <a class="el" href="include_2nucleus_2thread_8h-source.html#l00063">XNSHADOW</a>, and <a class="el" href="include_2nucleus_2thread_8h-source.html#l00035">XNSUSP</a>.</p>
<p>Referenced by <a class="el" href="skins_2posix_2thread_8c-source.html#l00165">pthread_create()</a>, <a class="el" href="ksrc_2skins_2native_2task_8c-source.html#l00249">rt_task_create()</a>, and <a class="el" href="drvlib_8c-source.html#l00139">rtdm_task_init()</a>.</p>
</div>
</div><p>
<a class="anchor" name="g4d14486d26a32a2660697f5a88d8301d"></a><!-- doxytag: member="pod.h::xnpod_migrate_thread" ref="g4d14486d26a32a2660697f5a88d8301d" args="(int cpu)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int xnpod_migrate_thread </td>
<td>(</td>
<td class="paramtype">int </td>
<td class="paramname"> <em>cpu</em> </td>
<td> ) </td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Migrate the current thread.
<p>
This call makes the current thread migrate to another CPU if its affinity allows it.<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>cpu</em> </td><td>The destination CPU.</td></tr>
</table>
</dl>
<dl compact><dt><b>Return values:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>0</em> </td><td>if the thread could migrate ; </td></tr>
<tr><td valign="top"></td><td valign="top"><em>-EPERM</em> </td><td>if the calling context is asynchronous, or the current thread affinity forbids this migration ; </td></tr>
<tr><td valign="top"></td><td valign="top"><em>-EBUSY</em> </td><td>if the scheduler is locked. </td></tr>
</table>
</dl>
<p>References <a class="el" href="pod_8h-source.html#l00251">xnpod_schedule()</a>.</p>
</div>
</div><p>
<a class="anchor" name="gce800481d23255eebe45f969e9434adf"></a><!-- doxytag: member="pod.h::xnpod_remove_hook" ref="gce800481d23255eebe45f969e9434adf" args="(int type, void(*routine)(xnthread_t *))" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int xnpod_remove_hook </td>
<td>(</td>
<td class="paramtype">int </td>
<td class="paramname"> <em>type</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">void(*)(xnthread_t *) </td>
<td class="paramname"> <em>routine</em></td><td> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Remove a nucleus hook.
<p>
This service removes a nucleus hook previously registered using <a class="el" href="group__pod.html#g96e6b70fb05da3603bebacde76b16f22" title="Install a nucleus hook.">xnpod_add_hook()</a>.<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>type</em> </td><td>Defines the kind of hook to remove among XNHOOK_THREAD_START, XNHOOK_THREAD_DELETE and XNHOOK_THREAD_SWITCH.</td></tr>
<tr><td valign="top"></td><td valign="top"><em>routine</em> </td><td>The address of the user-supplied routine to remove.</td></tr>
</table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>0 is returned on success. Otherwise, -EINVAL is returned if type is incorrect or if the routine has never been registered before.</dd></dl>
Environments:<p>
This service can be called from:<p>
<ul>
<li>Kernel module initialization/cleanup code</li><li>Kernel-based task</li><li>User-space task</li></ul>
<p>
Rescheduling: never.
<p>Referenced by <a class="el" href="ksrc_2skins_2native_2task_8c-source.html#l01260">rt_task_remove_hook()</a>.</p>
</div>
</div><p>
<a class="anchor" name="g61624578d0f1979f1ca6a5e9e49a74a3"></a><!-- doxytag: member="pod.h::xnpod_restart_thread" ref="g61624578d0f1979f1ca6a5e9e49a74a3" args="(xnthread_t *thread)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void xnpod_restart_thread </td>
<td>(</td>
<td class="paramtype">xnthread_t * </td>
<td class="paramname"> <em>thread</em> </td>
<td> ) </td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Restart a thread.
<p>
Restarts a previously started thread. The thread is first terminated then respawned using the same information that prevailed when it was first started, including the mode bits and interrupt mask initially passed to the <a class="el" href="group__pod.html#gd322f6afd62430705486a9036d0b7d66" title="Initial start of a newly created thread.">xnpod_start_thread()</a> service. As a consequence of this call, the thread entry point is rerun.<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>thread</em> </td><td>The descriptor address of the affected thread which must have been previously started by the <a class="el" href="group__pod.html#gd322f6afd62430705486a9036d0b7d66" title="Initial start of a newly created thread.">xnpod_start_thread()</a> service.</td></tr>
</table>
</dl>
Self-restarting a thread is allowed. However, restarting the root thread is not. Restarting a thread which was never started once leads to a null-effect.<p>
Environments:<p>
This service can be called from:<p>
<ul>
<li>Kernel module initialization/cleanup code</li><li>Kernel-based task</li></ul>
<p>
Rescheduling: possible.
<p>References <a class="el" href="pod_8h-source.html#l00251">xnpod_schedule()</a>, <a class="el" href="include_2nucleus_2thread_8h-source.html#l00041">XNRESTART</a>, <a class="el" href="include_2nucleus_2thread_8h-source.html#l00064">XNROOT</a>, <a class="el" href="include_2nucleus_2thread_8h-source.html#l00063">XNSHADOW</a>, and <a class="el" href="include_2nucleus_2thread_8h-source.html#l00042">XNSTARTED</a>.</p>
</div>
</div><p>
<a class="anchor" name="gc3a7bf9e973782a8cfd6495a1786e812"></a><!-- doxytag: member="pod.h::xnpod_resume_thread" ref="gc3a7bf9e973782a8cfd6495a1786e812" args="(xnthread_t *thread, xnflags_t mask)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void xnpod_resume_thread </td>
<td>(</td>
<td class="paramtype">xnthread_t * </td>
<td class="paramname"> <em>thread</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">xnflags_t </td>
<td class="paramname"> <em>mask</em></td><td> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Resume a thread.
<p>
Resumes the execution of a thread previously suspended by one or more calls to <a class="el" href="group__pod.html#g767221cf87c198c5dc071e9f597dcb3a" title="Suspend a thread.">xnpod_suspend_thread()</a>. This call removes a suspensive condition affecting the target thread. When all suspensive conditions are gone, the thread is left in a READY state at which point it becomes eligible anew for scheduling.<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>thread</em> </td><td>The descriptor address of the resumed thread.</td></tr>
<tr><td valign="top"></td><td valign="top"><em>mask</em> </td><td>The suspension mask specifying the suspensive condition to remove from the thread's wait mask. Possible values usable by the caller are:</td></tr>
</table>
</dl>
<ul>
<li>XNSUSP. This flag removes the explicit suspension condition. This condition might be additive to the XNPEND condition.</li></ul>
<p>
<ul>
<li>XNDELAY. This flag removes the counted delay wait condition.</li></ul>
<p>
<ul>
<li>XNPEND. This flag removes the resource wait condition. If a watchdog is armed, it is automatically disarmed by this call. Unlike the two previous conditions, only the current thread can set this condition for itself, i.e. no thread can force another one to pend on a resource.</li></ul>
<p>
When the thread is eventually resumed by one or more calls to <a class="el" href="group__pod.html#gc3a7bf9e973782a8cfd6495a1786e812" title="Resume a thread.">xnpod_resume_thread()</a>, the caller of <a class="el" href="group__pod.html#g767221cf87c198c5dc071e9f597dcb3a" title="Suspend a thread.">xnpod_suspend_thread()</a> in the awakened thread that suspended itself should check for the following bits in its own information mask to determine what caused its wake up:<p>
<ul>
<li>XNRMID means that the caller must assume that the pended synchronization object has been destroyed (see <a class="el" href="group__synch.html#g82beb68147bc5f0306ab02a61a9dc76b" title="Unblock all waiters pending on a resource.">xnsynch_flush()</a>).</li></ul>
<p>
<ul>
<li>XNTIMEO means that the delay elapsed, or the watchdog went off before the corresponding synchronization object was signaled.</li></ul>
<p>
<ul>
<li>XNBREAK means that the wait has been forcibly broken by a call to <a class="el" href="group__pod.html#ge5f0d19e7a499b9b262f68a43ab545dd" title="Unblock a thread.">xnpod_unblock_thread()</a>.</li></ul>
<p>
Environments:<p>
This service can be called from:<p>
<ul>
<li>Kernel module initialization/cleanup code</li><li>Interrupt service routine</li><li>Kernel-based task</li><li>User-space task</li></ul>
<p>
Rescheduling: never.
<p>References <a class="el" href="sched_8h-source.html#l00064">xnsched::curr</a>, <a class="el" href="include_2nucleus_2thread_8h-source.html#l00037">XNDELAY</a>, <a class="el" href="include_2nucleus_2thread_8h-source.html#l00046">XNHELD</a>, <a class="el" href="include_2nucleus_2thread_8h-source.html#l00036">XNPEND</a>, <a class="el" href="include_2nucleus_2thread_8h-source.html#l00038">XNREADY</a>, <a class="el" href="synch_8c-source.html#l00900">xnsynch_forget_sleeper()</a>, and <a class="el" href="include_2nucleus_2timer_8h-source.html#l00505">xntimer_stop()</a>.</p>
<p>Referenced by <a class="el" href="ksrc_2skins_2native_2task_8c-source.html#l02059">rt_task_reply()</a>, <a class="el" href="ksrc_2skins_2native_2task_8c-source.html#l00514">rt_task_resume()</a>, <a class="el" href="pod_8c-source.html#l00736">xnpod_start_thread()</a>, <a class="el" href="pod_8c-source.html#l01713">xnpod_unblock_thread()</a>, <a class="el" href="synch_8c-source.html#l00848">xnsynch_flush()</a>, <a class="el" href="synch_8c-source.html#l00707">xnsynch_release()</a>, <a class="el" href="synch_8c-source.html#l00237">xnsynch_wakeup_one_sleeper()</a>, and <a class="el" href="synch_8c-source.html#l00309">xnsynch_wakeup_this_sleeper()</a>.</p>
</div>
</div><p>
<a class="anchor" name="gcf5b53f0405351327b89b0cc4976b962"></a><!-- doxytag: member="pod.h::xnpod_schedule" ref="gcf5b53f0405351327b89b0cc4976b962" args="(void)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void xnpod_schedule </td>
<td>(</td>
<td class="paramtype">void </td>
<td class="paramname"> </td>
<td> ) </td>
<td><code> [inline, static]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Rescheduling procedure entry point.
<p>
This is the central rescheduling routine which should be called to validate and apply changes which have previously been made to the nucleus scheduling state, such as suspending, resuming or changing the priority of threads. This call first determines if a thread switch should take place, and performs it as needed. <a class="el" href="group__pod.html#gcf5b53f0405351327b89b0cc4976b962" title="Rescheduling procedure entry point.">xnpod_schedule()</a> schedules out the current thread if:<p>
<ul>
<li>the current thread is now blocked or deleted.</li><li>a runnable thread from a higher priority scheduling class is waiting for the CPU.</li><li>the current thread does not lead the runnable threads from its own scheduling class (e.g. round-robin in the RT class).</li></ul>
<p>
The nucleus implements a lazy rescheduling scheme so that most of the services affecting the threads state MUST be followed by a call to the rescheduling procedure for the new scheduling state to be applied. In other words, multiple changes on the scheduler state can be done in a row, waking threads up, blocking others, without being immediately translated into the corresponding context switches, like it would be necessary would it appear that a higher priority thread than the current one became runnable for instance. When all changes have been applied, the rescheduling procedure is then called to consider those changes, and possibly replace the current thread by another one.<p>
As a notable exception to the previous principle however, every action which ends up suspending or deleting the current thread begets an immediate call to the rescheduling procedure on behalf of the service causing the state transition. For instance, self-suspension, self-destruction, or sleeping on a synchronization object automatically leads to a call to the rescheduling procedure, therefore the caller does not need to explicitly issue <a class="el" href="group__pod.html#gcf5b53f0405351327b89b0cc4976b962" title="Rescheduling procedure entry point.">xnpod_schedule()</a> after such operations.<p>
The rescheduling procedure always leads to a null-effect if it is called on behalf of an ISR or callout. Any outstanding scheduler lock held by the outgoing thread will be restored when the thread is scheduled back in.<p>
Calling this procedure with no applicable context switch pending is harmless and simply leads to a null-effect.<p>
Side-effects:<p>
<ul>
<li>If an asynchronous service routine exists, the pending asynchronous signals are delivered to a resuming thread or on behalf of the caller before it returns from the procedure if no context switch has taken place. This behaviour can be disabled by setting the XNASDI flag in the thread's status mask by calling <a class="el" href="group__pod.html#g629c06b152dabfdb679b6e49bd9f7734" title="Change a thread's control mode.">xnpod_set_thread_mode()</a>.</li></ul>
<p>
Environments:<p>
This service can be called from:<p>
<ul>
<li>Kernel module initialization/cleanup code</li><li>Interrupt service routine, although this leads to a no-op.</li><li>Kernel-based task</li><li>User-space task</li></ul>
<p>
<dl class="note" compact><dt><b>Note:</b></dt><dd>The switch hooks are called on behalf of the resuming thread. </dd></dl>
<p>References <a class="el" href="sched_8h-source.html#l00062">xnsched::status</a>.</p>
<p>Referenced by <a class="el" href="cancel_8c-source.html#l00089">pthread_cancel()</a>, <a class="el" href="ksrc_2skins_2posix_2cond_8c-source.html#l00576">pthread_cond_broadcast()</a>, <a class="el" href="ksrc_2skins_2posix_2cond_8c-source.html#l00526">pthread_cond_signal()</a>, <a class="el" href="skins_2posix_2thread_8c-source.html#l00302">pthread_detach()</a>, <a class="el" href="skins_2posix_2thread_8c-source.html#l00430">pthread_join()</a>, <a class="el" href="signal_8c-source.html#l00527">pthread_kill()</a>, <a class="el" href="ksrc_2skins_2posix_2mutex_8c-source.html#l00590">pthread_mutex_unlock()</a>, <a class="el" href="skins_2posix_2sched_8c-source.html#l00338">pthread_setschedparam()</a>, <a class="el" href="skins_2posix_2sched_8c-source.html#l00415">pthread_setschedparam_ex()</a>, <a class="el" href="signal_8c-source.html#l00699">pthread_sigmask()</a>, <a class="el" href="signal_8c-source.html#l00585">pthread_sigqueue_np()</a>, <a class="el" href="ksrc_2skins_2native_2alarm_8c-source.html#l00269">rt_alarm_delete()</a>, <a class="el" href="ksrc_2skins_2native_2buffer_8c-source.html#l01043">rt_buffer_clear()</a>, <a class="el" href="ksrc_2skins_2native_2buffer_8c-source.html#l00276">rt_buffer_delete()</a>, <a class="el" href="ksrc_2skins_2native_2cond_8c-source.html#l00351">rt_cond_broadcast()</a>, <a class="el" href="ksrc_2skins_2native_2cond_8c-source.html#l00227">rt_cond_delete()</a>, <a class="el" href="ksrc_2skins_2native_2cond_8c-source.html#l00295">rt_cond_signal()</a>, <a class="el" href="ksrc_2skins_2native_2event_8c-source.html#l00248">rt_event_delete()</a>, <a class="el" href="ksrc_2skins_2native_2event_8c-source.html#l00315">rt_event_signal()</a>, <a class="el" href="ksrc_2skins_2native_2heap_8c-source.html#l00631">rt_heap_free()</a>, <a class="el" href="ksrc_2skins_2native_2intr_8c-source.html#l00334">rt_intr_delete()</a>, <a class="el" href="ksrc_2skins_2native_2mutex_8c-source.html#l00563">rt_mutex_release()</a>, <a class="el" href="ksrc_2skins_2native_2queue_8c-source.html#l00595">rt_queue_send()</a>, <a class="el" href="ksrc_2skins_2native_2sem_8c-source.html#l00541">rt_sem_broadcast()</a>, <a class="el" href="ksrc_2skins_2native_2sem_8c-source.html#l00246">rt_sem_delete()</a>, <a class="el" href="ksrc_2skins_2native_2sem_8c-source.html#l00487">rt_sem_v()</a>, <a class="el" href="ksrc_2skins_2native_2task_8c-source.html#l01297">rt_task_catch()</a>, <a class="el" href="ksrc_2skins_2native_2task_8c-source.html#l01357">rt_task_notify()</a>, <a class="el" href="ksrc_2skins_2native_2task_8c-source.html#l02059">rt_task_reply()</a>, <a class="el" href="ksrc_2skins_2native_2task_8c-source.html#l00514">rt_task_resume()</a>, <a class="el" href="ksrc_2skins_2native_2task_8c-source.html#l01476">rt_task_set_mode()</a>, <a class="el" href="ksrc_2skins_2native_2task_8c-source.html#l00853">rt_task_set_priority()</a>, <a class="el" href="ksrc_2skins_2native_2task_8c-source.html#l01063">rt_task_unblock()</a>, <a class="el" href="drvlib_8c-source.html#l00850">rtdm_event_signal()</a>, <a class="el" href="drvlib_8c-source.html#l01302">rtdm_sem_up()</a>, <a class="el" href="ksrc_2skins_2posix_2sem_8c-source.html#l00716">sem_post()</a>, <a class="el" href="pod_8c-source.html#l01078">xnpod_delete_thread()</a>, <a class="el" href="pod_8c-source.html#l01915">xnpod_migrate_thread()</a>, <a class="el" href="pod_8c-source.html#l00935">xnpod_restart_thread()</a>, <a class="el" href="pod_8c-source.html#l00461">xnpod_shutdown()</a>, <a class="el" href="pod_8c-source.html#l00736">xnpod_start_thread()</a>, <a class="el" href="pod_8c-source.html#l00883">xnpod_stop_thread()</a>, <a class="el" href="pod_8c-source.html#l01361">xnpod_suspend_thread()</a>, <a class="el" href="nucleus_2registry_8c-source.html#l00573">xnregistry_enter()</a>, <a class="el" href="nucleus_2registry_8c-source.html#l01084">xnregistry_put()</a>, <a class="el" href="select_8c-source.html#l00110">xnselect_bind()</a>, and <a class="el" href="select_8c-source.html#l00179">xnselect_destroy()</a>.</p>
</div>
</div><p>
<a class="anchor" name="g629c06b152dabfdb679b6e49bd9f7734"></a><!-- doxytag: member="pod.h::xnpod_set_thread_mode" ref="g629c06b152dabfdb679b6e49bd9f7734" args="(xnthread_t *thread, xnflags_t clrmask, xnflags_t setmask)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">xnflags_t xnpod_set_thread_mode </td>
<td>(</td>
<td class="paramtype">xnthread_t * </td>
<td class="paramname"> <em>thread</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">xnflags_t </td>
<td class="paramname"> <em>clrmask</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">xnflags_t </td>
<td class="paramname"> <em>setmask</em></td><td> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Change a thread's control mode.
<p>
Change the control mode of a given thread. The control mode affects the behaviour of the nucleus regarding the specified thread.<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>thread</em> </td><td>The descriptor address of the affected thread.</td></tr>
<tr><td valign="top"></td><td valign="top"><em>clrmask</em> </td><td>Clears the corresponding bits from the control field before setmask is applied. The scheduler lock held by the current thread can be forcibly released by passing the XNLOCK bit in this mask. In this case, the lock nesting count is also reset to zero.</td></tr>
<tr><td valign="top"></td><td valign="top"><em>setmask</em> </td><td>The new thread mode. The following flags can be part of this bitmask, each of them affecting the nucleus behaviour regarding the thread:</td></tr>
</table>
</dl>
<ul>
<li>XNLOCK causes the thread to lock the scheduler. The target thread will have to call the xnpod_unlock_sched() service to unlock the scheduler or clear the XNLOCK bit forcibly using this service. A non-preemptible thread may still block, in which case, the lock is reasserted when the thread is scheduled back in.</li></ul>
<p>
<ul>
<li>XNASDI disables the asynchronous signal handling for this thread. See <a class="el" href="group__pod.html#gcf5b53f0405351327b89b0cc4976b962" title="Rescheduling procedure entry point.">xnpod_schedule()</a> for more on this.</li></ul>
<p>
<ul>
<li>XNRPIOFF disables thread priority coupling between Xenomai and Linux schedulers. This bit prevents the root Linux thread from inheriting the priority of the running shadow Xenomai thread. Use CONFIG_XENO_OPT_RPIOFF to globally disable priority coupling.</li></ul>
<p>
Environments:<p>
This service can be called from:<p>
<ul>
<li>Kernel-based task</li><li>User-space task in primary mode.</li></ul>
<p>
Rescheduling: never, therefore, the caller should reschedule if XNLOCK has been passed into <em>clrmask</em>.
<p>References <a class="el" href="include_2nucleus_2thread_8h-source.html#l00050">XNLOCK</a>.</p>
<p>Referenced by <a class="el" href="skins_2posix_2thread_8c-source.html#l00666">pthread_set_mode_np()</a>, and <a class="el" href="ksrc_2skins_2native_2task_8c-source.html#l01476">rt_task_set_mode()</a>.</p>
</div>
</div><p>
<a class="anchor" name="ged5776a428e7c59b52b1da76f0d765fa"></a><!-- doxytag: member="pod.h::xnpod_set_thread_periodic" ref="ged5776a428e7c59b52b1da76f0d765fa" args="(xnthread_t *thread, xnticks_t idate, xnticks_t period)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int xnpod_set_thread_periodic </td>
<td>(</td>
<td class="paramtype">xnthread_t * </td>
<td class="paramname"> <em>thread</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">xnticks_t </td>
<td class="paramname"> <em>idate</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">xnticks_t </td>
<td class="paramname"> <em>period</em></td><td> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Make a thread periodic.
<p>
Make a thread periodic by programming its first release point and its period in the processor time line. Subsequent calls to <a class="el" href="group__pod.html#gf836996e4a3378928f2a9f93a4915cfa" title="Wait for the next periodic release point.">xnpod_wait_thread_period()</a> will delay the thread until the next periodic release point in the processor timeline is reached.<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>thread</em> </td><td>The descriptor address of the affected thread. This thread is immediately delayed until the first periodic release point is reached.</td></tr>
<tr><td valign="top"></td><td valign="top"><em>idate</em> </td><td>The initial (absolute) date of the first release point, expressed in clock ticks (see note). The affected thread will be delayed until this point is reached. If <em>idate</em> is equal to XN_INFINITE, the current system date is used, and no initial delay takes place.</td></tr>
<tr><td valign="top"></td><td valign="top"><em>period</em> </td><td>The period of the thread, expressed in clock ticks (see note). As a side-effect, passing XN_INFINITE attempts to stop the thread's periodic timer; in the latter case, the routine always exits succesfully, regardless of the previous state of this timer.</td></tr>
</table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>0 is returned upon success. Otherwise:</dd></dl>
<ul>
<li>-ETIMEDOUT is returned <em>idate</em> is different from XN_INFINITE and represents a date in the past.</li></ul>
<p>
<ul>
<li>-EWOULDBLOCK is returned if the relevant time base has not been initialized by a call to xnpod_init_timebase().</li></ul>
<p>
<ul>
<li>-EINVAL is returned if <em>period</em> is different from XN_INFINITE but shorter than the scheduling latency value for the target system, as available from /proc/xenomai/latency.</li></ul>
<p>
Environments:<p>
This service can be called from:<p>
<ul>
<li>Kernel module initialization/cleanup code</li><li>Kernel-based task</li><li>User-space task</li></ul>
<p>
Rescheduling: possible if the operation affects the current thread and <em>idate</em> has not elapsed yet.<p>
<dl class="note" compact><dt><b>Note:</b></dt><dd>The <em>idate</em> and <em>period</em> values will be interpreted as jiffies if <em>thread</em> is bound to a periodic time base (see xnpod_init_thread), or nanoseconds otherwise. </dd></dl>
<p>References <a class="el" href="include_2nucleus_2thread_8h-source.html#l00037">XNDELAY</a>, <a class="el" href="pod_8c-source.html#l01361">xnpod_suspend_thread()</a>, <a class="el" href="include_2nucleus_2timer_8h-source.html#l00473">xntimer_start()</a>, and <a class="el" href="include_2nucleus_2timer_8h-source.html#l00505">xntimer_stop()</a>.</p>
<p>Referenced by <a class="el" href="skins_2posix_2thread_8c-source.html#l00567">pthread_make_periodic_np()</a>, <a class="el" href="ksrc_2skins_2native_2task_8c-source.html#l00725">rt_task_set_periodic()</a>, and <a class="el" href="drvlib_8c-source.html#l00139">rtdm_task_init()</a>.</p>
</div>
</div><p>
<a class="anchor" name="g6d535ef9821e98fd7f257b50a3c8d595"></a><!-- doxytag: member="pod.h::xnpod_set_thread_schedparam" ref="g6d535ef9821e98fd7f257b50a3c8d595" args="(struct xnthread *thread, struct xnsched_class *sched_class, const union xnsched_policy_param *sched_param)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int xnpod_set_thread_schedparam </td>
<td>(</td>
<td class="paramtype">struct xnthread * </td>
<td class="paramname"> <em>thread</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">struct xnsched_class * </td>
<td class="paramname"> <em>sched_class</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const union xnsched_policy_param * </td>
<td class="paramname"> <em>sched_param</em></td><td> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Change the base scheduling parameters of a thread.
<p>
Changes the base scheduling policy and paramaters of a thread. If the thread is currently blocked, waiting in priority-pending mode (XNSYNCH_PRIO) for a synchronization object to be signaled, the nucleus will attempt to reorder the object's wait queue so that it reflects the new sleeper's priority, unless the XNSYNCH_DREORD flag has been set for the pended object.<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>thread</em> </td><td>The descriptor address of the affected thread.</td></tr>
<tr><td valign="top"></td><td valign="top"><em>sched_class</em> </td><td>The new scheduling class the thread should be assigned to.</td></tr>
<tr><td valign="top"></td><td valign="top"><em>sched_param</em> </td><td>The scheduling parameters to set for the thread; <em>sched_param</em> must be valid within the context of <em>sched_class</em>.</td></tr>
</table>
</dl>
It is absolutely required to use this service to change a thread priority, in order to have all the needed housekeeping chores correctly performed. i.e. Do *not* call xnsched_set_policy() directly or worse, change the thread.cprio field by hand in any case.<p>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>0 is returned on success. Otherwise, a negative error code indicates the cause of a failure that happened in the scheduling class implementation for <em>sched_class</em>. Invalid parameters passed into <em>sched_param</em> are common causes of error.</dd></dl>
Side-effects:<p>
<ul>
<li>This service does not call the rescheduling procedure but may affect the state of the runnable queue for the previous and new scheduling classes.</li></ul>
<p>
<ul>
<li>Assigning the same scheduling class and parameters to a running or ready thread moves it to the end of the runnable queue, thus causing a manual round-robin.</li></ul>
<p>
<ul>
<li>If the thread is a user-space shadow, this call propagates the request to the mated Linux task.</li></ul>
<p>
Environments:<p>
This service can be called from:<p>
<ul>
<li>Kernel module initialization/cleanup code</li><li>Interrupt service routine</li><li>Kernel-based task</li><li>User-space task</li></ul>
<p>
Rescheduling: never.
<p>Referenced by <a class="el" href="skins_2posix_2sched_8c-source.html#l00338">pthread_setschedparam()</a>, <a class="el" href="skins_2posix_2sched_8c-source.html#l00415">pthread_setschedparam_ex()</a>, and <a class="el" href="ksrc_2skins_2native_2task_8c-source.html#l00853">rt_task_set_priority()</a>.</p>
</div>
</div><p>
<a class="anchor" name="g4b8647e7a6969962c788669ff8d46d3b"></a><!-- doxytag: member="pod.h::xnpod_set_thread_tslice" ref="g4b8647e7a6969962c788669ff8d46d3b" args="(struct xnthread *thread, xnticks_t quantum)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int xnpod_set_thread_tslice </td>
<td>(</td>
<td class="paramtype">struct xnthread * </td>
<td class="paramname"> <em>thread</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">xnticks_t </td>
<td class="paramname"> <em>quantum</em></td><td> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Set thread time-slicing information.
<p>
Update the time-slicing information for a given thread. This service enables or disables round-robin scheduling for the thread, depending on the value of <em>quantum</em>. By default, times-slicing is disabled for a new thread initialized by a call to <a class="el" href="group__pod.html#gd71ebccc5b7b3d367f65127a8849c036" title="Initialize a new thread.">xnpod_init_thread()</a>.<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>thread</em> </td><td>The descriptor address of the affected thread.</td></tr>
<tr><td valign="top"></td><td valign="top"><em>quantum</em> </td><td>The time quantum assigned to the thread expressed in time-slicing ticks (see note). If <em>quantum</em> is different from XN_INFINITE, the time-slice for the thread is set to that value and its current time credit is refilled (i.e. the thread is given a full time-slice to run next). Otherwise, if <em>quantum</em> equals XN_INFINITE, time-slicing is stopped for that thread.</td></tr>
</table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>0 is returned upon success. Otherwise:</dd></dl>
<ul>
<li>-EINVAL is returned if the base scheduling class of the target thread does not support time-slicing.</li></ul>
<p>
Environments:<p>
This service can be called from:<p>
<ul>
<li>Kernel module initialization/cleanup code</li><li>Kernel-based task</li><li>User-space task</li></ul>
<p>
Rescheduling: never.<p>
<dl class="note" compact><dt><b>Note:</b></dt><dd>If <em>thread</em> is bound to a periodic timebase, <em>quantum</em> represents the number of periodic ticks in that timebase. Otherwise, if <em>thread</em> is bound to the master time base, a full time-slice will last: <em>quantum</em> * CONFIG_XENO_OPT_TIMING_VIRTICK. </dd></dl>
<p>References <a class="el" href="include_2nucleus_2thread_8h-source.html#l00051">XNRRB</a>, <a class="el" href="include_2nucleus_2timer_8h-source.html#l00473">xntimer_start()</a>, and <a class="el" href="include_2nucleus_2timer_8h-source.html#l00505">xntimer_stop()</a>.</p>
<p>Referenced by <a class="el" href="skins_2posix_2thread_8c-source.html#l00165">pthread_create()</a>, <a class="el" href="skins_2posix_2sched_8c-source.html#l00338">pthread_setschedparam()</a>, <a class="el" href="skins_2posix_2sched_8c-source.html#l00415">pthread_setschedparam_ex()</a>, and <a class="el" href="ksrc_2skins_2native_2task_8c-source.html#l01576">rt_task_slice()</a>.</p>
</div>
</div><p>
<a class="anchor" name="g824dc22468666c9f14da1842f0184b84"></a><!-- doxytag: member="pod.h::xnpod_shutdown" ref="g824dc22468666c9f14da1842f0184b84" args="(int xtype)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void xnpod_shutdown </td>
<td>(</td>
<td class="paramtype">int </td>
<td class="paramname"> <em>xtype</em> </td>
<td> ) </td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Shutdown the current pod.
<p>
Forcibly shutdowns the active pod. All existing nucleus threads (but the root one) are terminated, and the system heap is freed.<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>xtype</em> </td><td>An exit code passed to the host environment who started the nucleus. Zero is always interpreted as a successful return.</td></tr>
</table>
</dl>
The nucleus never calls this routine directly. Skins should provide their own shutdown handlers which end up calling <a class="el" href="group__pod.html#g824dc22468666c9f14da1842f0184b84" title="Shutdown the current pod.">xnpod_shutdown()</a> after their own housekeeping chores have been carried out.<p>
Environments:<p>
This service can be called from:<p>
<ul>
<li>Kernel module initialization/cleanup code</li></ul>
<p>
Rescheduling: never.
<p>References <a class="el" href="ksrc_2nucleus_2heap_8c-source.html#l00317">xnheap_destroy()</a>, <a class="el" href="pod_8c-source.html#l01078">xnpod_delete_thread()</a>, <a class="el" href="pod_8c-source.html#l02774">xnpod_disable_timesource()</a>, <a class="el" href="pod_8h-source.html#l00251">xnpod_schedule()</a>, <a class="el" href="include_2nucleus_2thread_8h-source.html#l00064">XNROOT</a>, and <a class="el" href="ksrc_2nucleus_2timer_8c-source.html#l00903">xntimer_destroy()</a>.</p>
<p>Referenced by <a class="el" href="pod_8c-source.html#l00339">xnpod_init()</a>.</p>
</div>
</div><p>
<a class="anchor" name="gd322f6afd62430705486a9036d0b7d66"></a><!-- doxytag: member="pod.h::xnpod_start_thread" ref="gd322f6afd62430705486a9036d0b7d66" args="(xnthread_t *thread, const struct xnthread_start_attr *attr)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int xnpod_start_thread </td>
<td>(</td>
<td class="paramtype">xnthread_t * </td>
<td class="paramname"> <em>thread</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const struct xnthread_start_attr * </td>
<td class="paramname"> <em>attr</em></td><td> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Initial start of a newly created thread.
<p>
Starts a (newly) created thread, scheduling it for the first time. This call releases the target thread from the XNDORMANT state. This service also sets the initial mode and interrupt mask for the new thread.<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>thread</em> </td><td>The descriptor address of the affected thread which must have been previously initialized by the <a class="el" href="group__pod.html#gd71ebccc5b7b3d367f65127a8849c036" title="Initialize a new thread.">xnpod_init_thread()</a> service.</td></tr>
<tr><td valign="top"></td><td valign="top"><em>attr</em> </td><td>A pointer to an attribute block describing the execution properties of the new thread. Members of this structure are defined as follows:</td></tr>
</table>
</dl>
<ul>
<li>mode: The initial thread mode. The following flags can be part of this bitmask, each of them affecting the nucleus behaviour regarding the started thread:</li></ul>
<p>
<ul>
<li>XNLOCK causes the thread to lock the scheduler when it starts. The target thread will have to call the xnpod_unlock_sched() service to unlock the scheduler. A non-preemptible thread may still block, in which case, the lock is reasserted when the thread is scheduled back in.</li></ul>
<p>
<ul>
<li>XNASDI disables the asynchronous signal handling for this thread. See <a class="el" href="group__pod.html#gcf5b53f0405351327b89b0cc4976b962" title="Rescheduling procedure entry point.">xnpod_schedule()</a> for more on this.</li></ul>
<p>
<ul>
<li>XNSUSP makes the thread start in a suspended state. In such a case, the thread will have to be explicitly resumed using the <a class="el" href="group__pod.html#gc3a7bf9e973782a8cfd6495a1786e812" title="Resume a thread.">xnpod_resume_thread()</a> service for its execution to actually begin.</li></ul>
<p>
<ul>
<li>imask: The interrupt mask that should be asserted when the thread starts. The processor interrupt state will be set to the given value when the thread starts running. The interpretation of this value might be different across real-time layers, but a non-zero value should always mark an interrupt masking in effect (e.g. local_irq_disable()). Conversely, a zero value should always mark a fully preemptible state regarding interrupts (e.g. local_irq_enable()).</li></ul>
<p>
<ul>
<li>affinity: The processor affinity of this thread. Passing XNPOD_ALL_CPUS or an empty affinity set means "any cpu".</li></ul>
<p>
<ul>
<li>entry: The address of the thread's body routine. In other words, it is the thread entry point.</li></ul>
<p>
<ul>
<li>cookie: A user-defined opaque cookie the nucleus will pass to the emerging thread as the sole argument of its entry point.</li></ul>
<p>
The START hooks are called on behalf of the calling context (if any).<p>
<dl compact><dt><b>Return values:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>0</em> </td><td>if <em>thread</em> could be started ;</td></tr>
<tr><td valign="top"></td><td valign="top"><em>-EBUSY</em> </td><td>if <em>thread</em> was not dormant or stopped ;</td></tr>
<tr><td valign="top"></td><td valign="top"><em>-EINVAL</em> </td><td>if the value of <em>attr->affinity</em> is invalid.</td></tr>
</table>
</dl>
Environments:<p>
This service can be called from:<p>
<ul>
<li>Kernel module initialization/cleanup code</li><li>Kernel-based task</li><li>User-space task</li></ul>
<p>
Rescheduling: possible.
<p>References <a class="el" href="include_2nucleus_2thread_8h-source.html#l00039">XNDORMANT</a>, <a class="el" href="pod_8c-source.html#l01575">xnpod_resume_thread()</a>, <a class="el" href="pod_8h-source.html#l00251">xnpod_schedule()</a>, <a class="el" href="include_2nucleus_2thread_8h-source.html#l00038">XNREADY</a>, <a class="el" href="include_2nucleus_2thread_8h-source.html#l00063">XNSHADOW</a>, <a class="el" href="include_2nucleus_2thread_8h-source.html#l00042">XNSTARTED</a>, and <a class="el" href="include_2nucleus_2thread_8h-source.html#l00035">XNSUSP</a>.</p>
<p>Referenced by <a class="el" href="skins_2posix_2thread_8c-source.html#l00165">pthread_create()</a>, <a class="el" href="ksrc_2skins_2native_2task_8c-source.html#l00364">rt_task_start()</a>, <a class="el" href="drvlib_8c-source.html#l00139">rtdm_task_init()</a>, and <a class="el" href="shadow_8c-source.html#l01282">xnshadow_map()</a>.</p>
</div>
</div><p>
<a class="anchor" name="gd86de7feeb37bbac6f6660916c3fe099"></a><!-- doxytag: member="pod.h::xnpod_stop_thread" ref="gd86de7feeb37bbac6f6660916c3fe099" args="(xnthread_t *thread)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void xnpod_stop_thread </td>
<td>(</td>
<td class="paramtype">xnthread_t * </td>
<td class="paramname"> <em>thread</em> </td>
<td> ) </td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Stop a thread.
<p>
Stop a previously started thread. The thread is put back into the dormant state; however, it is not deleted from the system.<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>thread</em> </td><td>The descriptor address of the affected thread which must have been previously started by the <a class="el" href="group__pod.html#gd322f6afd62430705486a9036d0b7d66" title="Initial start of a newly created thread.">xnpod_start_thread()</a> service.</td></tr>
</table>
</dl>
Environments:<p>
This service can be called from:<p>
<ul>
<li>Kernel module initialization/cleanup code</li><li>Kernel-based task</li><li>User-space task</li></ul>
<p>
Rescheduling: possible.
<p>References <a class="el" href="include_2nucleus_2thread_8h-source.html#l00039">XNDORMANT</a>, <a class="el" href="pod_8h-source.html#l00251">xnpod_schedule()</a>, <a class="el" href="pod_8c-source.html#l01361">xnpod_suspend_thread()</a>, and <a class="el" href="include_2nucleus_2thread_8h-source.html#l00064">XNROOT</a>.</p>
</div>
</div><p>
<a class="anchor" name="g767221cf87c198c5dc071e9f597dcb3a"></a><!-- doxytag: member="pod.h::xnpod_suspend_thread" ref="g767221cf87c198c5dc071e9f597dcb3a" args="(xnthread_t *thread, xnflags_t mask, xnticks_t timeout, xntmode_t timeout_mode, struct xnsynch *wchan)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void xnpod_suspend_thread </td>
<td>(</td>
<td class="paramtype">xnthread_t * </td>
<td class="paramname"> <em>thread</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">xnflags_t </td>
<td class="paramname"> <em>mask</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">xnticks_t </td>
<td class="paramname"> <em>timeout</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">xntmode_t </td>
<td class="paramname"> <em>timeout_mode</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">struct xnsynch * </td>
<td class="paramname"> <em>wchan</em></td><td> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Suspend a thread.
<p>
Suspends the execution of a thread according to a given suspensive condition. This thread will not be eligible for scheduling until it all the pending suspensive conditions set by this service are removed by one or more calls to <a class="el" href="group__pod.html#gc3a7bf9e973782a8cfd6495a1786e812" title="Resume a thread.">xnpod_resume_thread()</a>.<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>thread</em> </td><td>The descriptor address of the suspended thread.</td></tr>
<tr><td valign="top"></td><td valign="top"><em>mask</em> </td><td>The suspension mask specifying the suspensive condition to add to the thread's wait mask. Possible values usable by the caller are:</td></tr>
</table>
</dl>
<ul>
<li>XNSUSP. This flag forcibly suspends a thread, regardless of any resource to wait for. A reverse call to <a class="el" href="group__pod.html#gc3a7bf9e973782a8cfd6495a1786e812" title="Resume a thread.">xnpod_resume_thread()</a> specifying the XNSUSP bit must be issued to remove this condition, which is cumulative with other suspension bits.<em>wchan</em> should be NULL when using this suspending mode.</li></ul>
<p>
<ul>
<li>XNDELAY. This flags denotes a counted delay wait (in ticks) which duration is defined by the value of the timeout parameter.</li></ul>
<p>
<ul>
<li>XNPEND. This flag denotes a wait for a synchronization object to be signaled. The wchan argument must points to this object. A timeout value can be passed to bound the wait. This suspending mode should not be used directly by the client interface, but rather through the <a class="el" href="group__synch.html#g2747e9834546af461f118e7c90c9613e" title="Sleep on an ownerless synchronization object.">xnsynch_sleep_on()</a> call.</li></ul>
<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>timeout</em> </td><td>The timeout which may be used to limit the time the thread pends on a resource. This value is a wait time given in ticks (see note). It can either be relative, absolute monotonic, or absolute adjustable depending on <em>timeout_mode</em>. Passing XN_INFINITE <b>and</b> setting <em>timeout_mode</em> to XN_RELATIVE specifies an unbounded wait. All other values are used to initialize a watchdog timer. If the current operation mode of the system timer is oneshot and <em>timeout</em> elapses before <a class="el" href="group__pod.html#g767221cf87c198c5dc071e9f597dcb3a" title="Suspend a thread.">xnpod_suspend_thread()</a> has completed, then the target thread will not be suspended, and this routine leads to a null effect.</td></tr>
<tr><td valign="top"></td><td valign="top"><em>timeout_mode</em> </td><td>The mode of the <em>timeout</em> parameter. It can either be set to XN_RELATIVE, XN_ABSOLUTE, or XN_REALTIME (see also <a class="el" href="group__timer.html#g0ad3c70bed7fe1a45b45ee0875f031ab" title="Arm a timer.">xntimer_start()</a>).</td></tr>
<tr><td valign="top"></td><td valign="top"><em>wchan</em> </td><td>The address of a pended resource. This parameter is used internally by the synchronization object implementation code to specify on which object the suspended thread pends. NULL is a legitimate value when this parameter does not apply to the current suspending mode (e.g. XNSUSP).</td></tr>
</table>
</dl>
<dl class="note" compact><dt><b>Note:</b></dt><dd>If the target thread is a shadow which has received a Linux-originated signal, then this service immediately exits without suspending the thread, but raises the XNBREAK condition in its information mask.</dd></dl>
Environments:<p>
This service can be called from:<p>
<ul>
<li>Kernel module initialization/cleanup code</li><li>Interrupt service routine</li><li>Kernel-based task</li><li>User-space task</li></ul>
<p>
Rescheduling: possible if the current thread suspends itself.<p>
<dl class="note" compact><dt><b>Note:</b></dt><dd>The <em>timeout</em> value will be interpreted as jiffies if <em>thread</em> is bound to a periodic time base (see xnpod_init_thread), or nanoseconds otherwise. </dd></dl>
<p>References <a class="el" href="sched_8h-source.html#l00064">xnsched::curr</a>, <a class="el" href="include_2nucleus_2thread_8h-source.html#l00110">XNBREAK</a>, <a class="el" href="include_2nucleus_2thread_8h-source.html#l00037">XNDELAY</a>, <a class="el" href="include_2nucleus_2thread_8h-source.html#l00039">XNDORMANT</a>, <a class="el" href="include_2nucleus_2thread_8h-source.html#l00046">XNHELD</a>, <a class="el" href="include_2nucleus_2thread_8h-source.html#l00111">XNKICKED</a>, <a class="el" href="pod_8h-source.html#l00251">xnpod_schedule()</a>, <a class="el" href="include_2nucleus_2thread_8h-source.html#l00038">XNREADY</a>, <a class="el" href="include_2nucleus_2thread_8h-source.html#l00044">XNRELAX</a>, <a class="el" href="include_2nucleus_2thread_8h-source.html#l00109">XNRMID</a>, <a class="el" href="include_2nucleus_2thread_8h-source.html#l00113">XNROBBED</a>, <a class="el" href="include_2nucleus_2thread_8h-source.html#l00064">XNROOT</a>, <a class="el" href="include_2nucleus_2thread_8h-source.html#l00063">XNSHADOW</a>, <a class="el" href="include_2nucleus_2thread_8h-source.html#l00035">XNSUSP</a>, <a class="el" href="synch_8c-source.html#l00900">xnsynch_forget_sleeper()</a>, <a class="el" href="include_2nucleus_2thread_8h-source.html#l00108">XNTIMEO</a>, <a class="el" href="include_2nucleus_2timer_8h-source.html#l00473">xntimer_start()</a>, and <a class="el" href="include_2nucleus_2thread_8h-source.html#l00112">XNWAKEN</a>.</p>
<p>Referenced by <a class="el" href="clock_8c-source.html#l00221">clock_nanosleep()</a>, <a class="el" href="ksrc_2skins_2native_2task_8c-source.html#l00928">rt_task_sleep()</a>, <a class="el" href="ksrc_2skins_2native_2task_8c-source.html#l00992">rt_task_sleep_until()</a>, <a class="el" href="ksrc_2skins_2native_2task_8c-source.html#l00447">rt_task_suspend()</a>, <a class="el" href="pod_8c-source.html#l01273">xnpod_abort_thread()</a>, <a class="el" href="pod_8c-source.html#l00632">xnpod_init_thread()</a>, <a class="el" href="pod_8c-source.html#l02860">xnpod_set_thread_periodic()</a>, <a class="el" href="pod_8c-source.html#l00883">xnpod_stop_thread()</a>, <a class="el" href="pod_8c-source.html#l02541">xnpod_trap_fault()</a>, <a class="el" href="pod_8c-source.html#l02961">xnpod_wait_thread_period()</a>, <a class="el" href="shadow_8c-source.html#l01282">xnshadow_map()</a>, <a class="el" href="shadow_8c-source.html#l01137">xnshadow_relax()</a>, <a class="el" href="synch_8c-source.html#l00406">xnsynch_acquire()</a>, and <a class="el" href="synch_8c-source.html#l00171">xnsynch_sleep_on()</a>.</p>
</div>
</div><p>
<a class="anchor" name="gf95cac21ec23e44282461905dd3fc153"></a><!-- doxytag: member="pod.c::xnpod_trap_fault" ref="gf95cac21ec23e44282461905dd3fc153" args="(xnarch_fltinfo_t *fltinfo)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void xnpod_trap_fault </td>
<td>(</td>
<td class="paramtype">xnarch_fltinfo_t * </td>
<td class="paramname"> <em>fltinfo</em> </td>
<td> ) </td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Default fault handler.
<p>
This is the default handler which is called whenever an uncontrolled exception or fault is caught. If the fault is caught on behalf of a real-time thread, the fault is not propagated to the host system. Otherwise, the fault is unhandled by the nucleus and simply propagated.<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>fltinfo</em> </td><td>An opaque pointer to the arch-specific buffer describing the fault. The actual layout is defined by the xnarch_fltinfo_t type in each arch-dependent layer file. </td></tr>
</table>
</dl>
<p>References <a class="el" href="pod_8c-source.html#l01361">xnpod_suspend_thread()</a>, <a class="el" href="shadow_8c-source.html#l01137">xnshadow_relax()</a>, and <a class="el" href="include_2nucleus_2thread_8h-source.html#l00035">XNSUSP</a>.</p>
</div>
</div><p>
<a class="anchor" name="ge5f0d19e7a499b9b262f68a43ab545dd"></a><!-- doxytag: member="pod.h::xnpod_unblock_thread" ref="ge5f0d19e7a499b9b262f68a43ab545dd" args="(xnthread_t *thread)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int xnpod_unblock_thread </td>
<td>(</td>
<td class="paramtype">xnthread_t * </td>
<td class="paramname"> <em>thread</em> </td>
<td> ) </td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Unblock a thread.
<p>
Breaks the thread out of any wait it is currently in. This call removes the XNDELAY and XNPEND suspensive conditions previously put by <a class="el" href="group__pod.html#g767221cf87c198c5dc071e9f597dcb3a" title="Suspend a thread.">xnpod_suspend_thread()</a> on the target thread. If all suspensive conditions are gone, the thread is left in a READY state at which point it becomes eligible anew for scheduling.<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>thread</em> </td><td>The descriptor address of the unblocked thread.</td></tr>
</table>
</dl>
This call neither releases the thread from the XNSUSP, XNRELAX, XNDORMANT or XNHELD suspensive conditions.<p>
When the thread resumes execution, the XNBREAK bit is set in the unblocked thread's information mask. Unblocking a non-blocked thread is perfectly harmless.<p>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>non-zero is returned if the thread was actually unblocked from a pending wait state, 0 otherwise.</dd></dl>
Environments:<p>
This service can be called from:<p>
<ul>
<li>Kernel module initialization/cleanup code</li><li>Interrupt service routine</li><li>Kernel-based task</li><li>User-space task</li></ul>
<p>
Rescheduling: never.
<p>References <a class="el" href="include_2nucleus_2thread_8h-source.html#l00110">XNBREAK</a>, <a class="el" href="include_2nucleus_2thread_8h-source.html#l00037">XNDELAY</a>, <a class="el" href="include_2nucleus_2thread_8h-source.html#l00036">XNPEND</a>, and <a class="el" href="pod_8c-source.html#l01575">xnpod_resume_thread()</a>.</p>
<p>Referenced by <a class="el" href="cancel_8c-source.html#l00089">pthread_cancel()</a>, <a class="el" href="ksrc_2skins_2native_2task_8c-source.html#l01063">rt_task_unblock()</a>, <a class="el" href="pod_8c-source.html#l01078">xnpod_delete_thread()</a>, and <a class="el" href="shadow_8c-source.html#l00665">xnshadow_mark_sig()</a>.</p>
</div>
</div><p>
<a class="anchor" name="gf836996e4a3378928f2a9f93a4915cfa"></a><!-- doxytag: member="pod.h::xnpod_wait_thread_period" ref="gf836996e4a3378928f2a9f93a4915cfa" args="(unsigned long *overruns_r)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int xnpod_wait_thread_period </td>
<td>(</td>
<td class="paramtype">unsigned long * </td>
<td class="paramname"> <em>overruns_r</em> </td>
<td> ) </td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Wait for the next periodic release point.
<p>
Make the current thread wait for the next periodic release point in the processor time line.<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>overruns_r</em> </td><td>If non-NULL, <em>overruns_r</em> must be a pointer to a memory location which will be written with the count of pending overruns. This value is copied only when <a class="el" href="group__pod.html#gf836996e4a3378928f2a9f93a4915cfa" title="Wait for the next periodic release point.">xnpod_wait_thread_period()</a> returns -ETIMEDOUT or success; the memory location remains unmodified otherwise. If NULL, this count will never be copied back.</td></tr>
</table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>0 is returned upon success; if <em>overruns_r</em> is valid, zero is copied to the pointed memory location. Otherwise:</dd></dl>
<ul>
<li>-EWOULDBLOCK is returned if <a class="el" href="group__pod.html#ged5776a428e7c59b52b1da76f0d765fa" title="Make a thread periodic.">xnpod_set_thread_periodic()</a> has not previously been called for the calling thread.</li></ul>
<p>
<ul>
<li>-EINTR is returned if <a class="el" href="group__pod.html#ge5f0d19e7a499b9b262f68a43ab545dd" title="Unblock a thread.">xnpod_unblock_thread()</a> has been called for the waiting thread before the next periodic release point has been reached. In this case, the overrun counter is reset too.</li></ul>
<p>
<ul>
<li>-ETIMEDOUT is returned if the timer has overrun, which indicates that one or more previous release points have been missed by the calling thread. If <em>overruns_r</em> is valid, the count of pending overruns is copied to the pointed memory location.</li></ul>
<p>
Environments:<p>
This service can be called from:<p>
<ul>
<li>Kernel module initialization/cleanup code</li><li>Kernel-based task</li><li>User-space task</li></ul>
<p>
Rescheduling: always, unless the current release point has already been reached. In the latter case, the current thread immediately returns from this service without being delayed.
<p>References <a class="el" href="include_2nucleus_2thread_8h-source.html#l00110">XNBREAK</a>, <a class="el" href="include_2nucleus_2thread_8h-source.html#l00037">XNDELAY</a>, <a class="el" href="pod_8c-source.html#l01361">xnpod_suspend_thread()</a>, and <a class="el" href="ksrc_2nucleus_2timer_8c-source.html#l01002">xntimer_get_overruns()</a>.</p>
<p>Referenced by <a class="el" href="skins_2posix_2thread_8c-source.html#l00619">pthread_wait_np()</a>, and <a class="el" href="ksrc_2skins_2native_2task_8c-source.html#l00800">rt_task_wait_period()</a>.</p>
</div>
</div><p>
<a class="anchor" name="g657259b9accb3be41574f9970baef393"></a><!-- doxytag: member="pod.c::xnpod_welcome_thread" ref="g657259b9accb3be41574f9970baef393" args="(xnthread_t *thread, int imask)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void xnpod_welcome_thread </td>
<td>(</td>
<td class="paramtype">xnthread_t * </td>
<td class="paramname"> <em>thread</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int </td>
<td class="paramname"> <em>imask</em></td><td> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Thread prologue.
<p>
<p><b>For internal use only.</b></p>
<p>
This internal routine is called on behalf of a (re)starting thread's prologue before the user entry point is invoked. This call is reserved for internal housekeeping chores and cannot be inlined.<p>
Entered with nklock locked, irqs off. </p>
<p>References <a class="el" href="include_2nucleus_2thread_8h-source.html#l00050">XNLOCK</a>, <a class="el" href="pod_8c-source.html#l01981">xnpod_dispatch_signals()</a>, and <a class="el" href="include_2nucleus_2thread_8h-source.html#l00041">XNRESTART</a>.</p>
</div>
</div><p>
</div>
<hr size="1"><address style="text-align: right;"><small>Generated on Mon Aug 2 12:48:38 2010 for Xenomai API by
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.6 </small></address>
</body>
</html>
|