My Project
threadsupport.cc
Go to the documentation of this file.
1 #include <string.h>
2 #include <stdlib.h>
3 
4 #ifdef __cplusplus
5 extern "C" {
6 #endif
7 
8 #ifdef PSINGULAR
9 typedef struct InitList {
10  struct InitList *next;
11  void (*func)();
12 } InitList;
13 
14 static InitList *inits;
15 
17  InitList *list = inits;
18  while (list) {
19  list->func();
20  list = list->next;
21  }
22 }
23 
24 void pSingular_register_init(void (*f)()) {
25  InitList *next = (InitList *) malloc(sizeof(InitList));
26  next->next = inits;
27  next->func = f;
28  inits = next;
29  (*f)();
30 }
31 
32 void pSingular_init_var(void *s, void *t, long n) {
33  memcpy(s, t, n);
34 }
35 
36 void *pSingular_alloc_var(long n) {
37  return malloc(n);
38 }
39 
40 #endif
41 #ifdef __cplusplus
42 }
43 #endif
FILE * f
Definition: checklibs.c:9
const CanonicalForm int s
Definition: facAbsFact.cc:51
ListNode * next
Definition: janet.h:31
void * malloc(size_t size)
Definition: omalloc.c:92
void pSingular_initialize_thread()