Scrambler
1
|
00001 //######################################################################### 00002 // 00003 // Copyright (C) 2003-2012 Department of Physics and Astronomy, 00004 // University of Rochester, 00005 // Rochester, NY 00006 // 00007 // fpth_lib.c is part of AstroBEAR. 00008 // 00009 // AstroBEAR is free software: you can redistribute it and/or modify 00010 // it under the terms of the GNU General Public License as published by 00011 // the Free Software Foundation, either version 3 of the License, or 00012 // (at your option) any later version. 00013 // 00014 // AstroBEAR is distributed in the hope that it will be useful, 00015 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00017 // GNU General Public License for more details. 00018 // 00019 // You should have received a copy of the GNU General Public License 00020 // along with AstroBEAR. If not, see <http://www.gnu.org/licenses/>. 00021 // 00022 //######################################################################### 00026 #include <pth.h> 00027 00028 #include <stdio.h> 00029 //#include <stdlib.h> 00030 //#include <errno.h> 00031 //#include <sched.h> 00032 00033 00034 00035 void fpth_init_(int *ierr) 00036 00037 { 00038 *ierr = pth_init(); 00039 return; 00040 } 00041 00042 void fpth_spawn_(pth_t *thread, pth_attr_t *attr, void (*start_routine)(void*), void *data) 00043 { 00044 *thread = pth_spawn(*attr, (void*)start_routine, data); 00045 return; 00046 } 00047 00048 00049 void fpth_resume_(pth_t *thread, int *ierr) 00050 { 00051 *ierr = pth_resume(*thread); 00052 return; 00053 } 00054 00055 void fpth_suspend_(pth_t *thread, int *ierr) 00056 { 00057 *ierr = pth_suspend(*thread); 00058 return; 00059 } 00060 00061 void fpth_yield_(pth_t *thread, int *ierr) 00062 { 00063 *ierr = pth_yield(*thread); 00064 return; 00065 } 00066 00067 void fpth_yield_any_(int *ierr) 00068 { 00069 *ierr = pth_yield(NULL); 00070 return; 00071 } 00072 00073 void fpth_join_(pth_t *thread, void **value, int *ierr) 00074 { 00075 *ierr = pth_join(*thread,(void**) value); 00076 return; 00077 } 00078 00079 void fpth_exit_(void *data) 00080 { 00081 pth_exit((void *)data); 00082 return; 00083 } 00084 00085 00086 void fpth_self_(pth_t *thread) 00087 { 00088 *thread = pth_self(); 00089 return; 00090 } 00091 00092 00093 void fpth_attr_of_(pth_attr_t *attr, pth_t *thread) 00094 { 00095 *attr=pth_attr_of(*thread); 00096 return; 00097 } 00098 00099 void fpth_attr_new_(pth_attr_t *attr) 00100 { 00101 *attr=pth_attr_new(); 00102 return; 00103 } 00104 00105 void fpth_attr_init_(pth_attr_t *attr, int *ierr) 00106 { 00107 *ierr=pth_attr_init(*attr); 00108 return; 00109 } 00110 00111 00112 /*void fpth_attr_set_(pth_attr_t *attr, int *field, void *data, int *ierr) 00113 { 00114 *ierr=pth_attr_set(*attr, *field, (void**)data); 00115 return; 00116 } 00117 */ 00118 00119 void fpth_attr_get_(pth_attr_t *attr, int *field, void *data, int *ierr) 00120 { 00121 *ierr=pth_attr_get(*attr, *field, data); 00122 return; 00123 } 00124 00125 void fpth_attr_get_stacksize_(pth_attr_t *attr, int *data, int *ierr) 00126 { 00127 unsigned stacksize; 00128 *ierr=pth_attr_get(*attr, PTH_ATTR_STACK_SIZE, stacksize); 00129 *data=stacksize; 00130 return; 00131 } 00132 00133 void fpth_attr_set_stacksize_(pth_attr_t *attr, int *data, int *ierr) 00134 { 00135 unsigned stacksize; 00136 stacksize = *data; 00137 *ierr=pth_attr_set(*attr, PTH_ATTR_STACK_SIZE, stacksize); 00138 return; 00139 } 00140 00141 00142 void fpth_attr_set_prio_(pth_attr_t *attr, int *data, int *ierr) 00143 { 00144 *ierr=pth_attr_set(*attr, PTH_ATTR_PRIO, *data); 00145 return; 00146 } 00147