My Project  debian-1:4.1.2-p1+ds-2
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 typedef struct InitList {
9  struct InitList *next;
10  void (*func)();
11 } InitList;
12 
13 static InitList *inits;
14 
16  InitList *list = inits;
17  while (list) {
18  list->func();
19  list = list->next;
20  }
21 }
22 
23 void pSingular_register_init(void (*f)()) {
24  InitList *next = (InitList *) malloc(sizeof(InitList));
25  next->next = inits;
26  next->func = f;
27  inits = next;
28  (*f)();
29 }
30 
31 void pSingular_init_var(void *s, void *t, long n) {
32  memcpy(s, t, n);
33 }
34 
35 void *pSingular_alloc_var(long n) {
36  return malloc(n);
37 }
38 
39 #ifdef __cplusplus
40 }
41 #endif
FILE * f
Definition: checklibs.c:9
const CanonicalForm int s
Definition: facAbsFact.cc:55
ListNode * next
Definition: janet.h:31
void * malloc(size_t size)
Definition: omalloc.c:92
struct InitList * next
Definition: threadsupport.cc:9
void(* func)()
static InitList * inits
void pSingular_initialize_thread()
void pSingular_register_init(void(*f)())
void pSingular_init_var(void *s, void *t, long n)
void * pSingular_alloc_var(long n)