Changeset 25fe907 in git for Singular/iplib.cc
- Timestamp:
- Jan 24, 2019, 1:07:07 PM (5 years ago)
- Branches:
- (u'spielwiese', 'd0474371d8c5d8068ab70bfb42719c97936b18a6')
- Children:
- a3f0feac28fd347ce5b5d091108f9128d7b13554
- Parents:
- d0c48800963359deb121c3d103d17df80ba21b8e
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/iplib.cc
rd0c488 r25fe907 60 60 extern int yylp_errno; 61 61 extern int yylplineno; 62 extern c har *yylp_errlist[];62 extern const char *yylp_errlist[]; 63 63 void print_init(); 64 64 libstackv library_stack; … … 1088 1088 /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ 1089 1089 #ifdef HAVE_DYNAMIC_LOADING 1090 BOOLEAN load_modules(const char *newlib, char *fullname, BOOLEAN autoexport) 1090 #include <map> 1091 #include <string> 1092 #include <pthread.h> 1093 1094 STATIC_VAR std::map<std::string, void *> *dyn_modules; 1095 1096 bool registered_dyn_module(char *fullname) { 1097 if (dyn_modules == NULL) 1098 return false; 1099 std::string fname = fullname; 1100 return !(dyn_modules->count(fname)); 1101 } 1102 1103 void register_dyn_module(char *fullname, void * handle) { 1104 std::string fname = fullname; 1105 if (dyn_modules == NULL) 1106 dyn_modules = new std::map<std::string, void *>(); 1107 dyn_modules->insert(std::pair<std::string, void *>(fname, handle)); 1108 } 1109 1110 void close_all_dyn_modules() { 1111 for (std::map<std::string, void *>::iterator it = dyn_modules->begin(); 1112 it != dyn_modules->end(); 1113 it++) 1114 { 1115 dynl_close(it->second); 1116 } 1117 delete dyn_modules; 1118 dyn_modules = NULL; 1119 } 1120 BOOLEAN load_modules_aux(const char *newlib, char *fullname, BOOLEAN autoexport) 1091 1121 { 1092 1122 #ifdef HAVE_STATIC … … 1143 1173 } 1144 1174 IDPACKAGE(pl)->language = LANG_C; 1145 if ( dynl_check_opened(FullName))1175 if (registered_dyn_module(FullName)) 1146 1176 { 1147 1177 if (BVERBOSE(V_LOAD_LIB)) Warn( "%s already loaded as C library", fullname); … … 1178 1208 currPack->loaded=1; 1179 1209 currPack=s; /* reset currPack to previous */ 1210 register_dyn_module(fullname, IDPACKAGE(pl)->handle); 1180 1211 RET=FALSE; 1181 1212 } … … 1192 1223 return RET; 1193 1224 #endif /*STATIC */ 1225 } 1226 1227 BOOLEAN load_modules(const char *newlib, char *fullname, BOOLEAN autoexport) { 1228 GLOBAL_VAR static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; 1229 pthread_mutex_lock(&mutex); 1230 BOOLEAN r = load_modules_aux(newlib, fullname, autoexport); 1231 pthread_mutex_unlock(&mutex); 1232 return r; 1194 1233 } 1195 1234 #endif /* HAVE_DYNAMIC_LOADING */
Note: See TracChangeset
for help on using the changeset viewer.