source: git/factory/threadsupport.cc @ c1b52b

spielwiese
Last change on this file since c1b52b was d4c9b0, checked in by Hans Schoenemann <hannes@…>, 5 years ago
fix: compile threadsupport.cc if PSINGULAR
  • Property mode set to 100644
File size: 672 bytes
Line 
1#include <string.h>
2#include <stdlib.h>
3
4#ifdef __cplusplus
5extern "C" {
6#endif
7
8#ifdef PSINGULAR
9typedef struct InitList {
10  struct InitList *next;
11  void (*func)();
12} InitList;
13
14static InitList *inits;
15
16void pSingular_initialize_thread() {
17  InitList *list = inits;
18  while (list) {
19    list->func();
20    list = list->next;
21  }
22}
23
24void 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
32void pSingular_init_var(void *s, void *t, long n) {
33  memcpy(s, t, n);
34}
35
36void *pSingular_alloc_var(long n) {
37  return malloc(n);
38}
39
40#endif
41#ifdef __cplusplus
42}
43#endif
Note: See TracBrowser for help on using the repository browser.