forked from Singular/Singular
-
Notifications
You must be signed in to change notification settings - Fork 0
Multithreaded concept
malex984 edited this page Sep 28, 2012
·
23 revisions
Multi-library concept:
- Some of our libraries need their own TLS
- xthread should provide the basic support for C++:
- Common TLS Structure that accommodates places for all of our libs: void* lib_tls[MAXLIBID] = 0,0,0...0;
- Common TLS macros for getting at it
- new_thread, which should take Init and Done as well as run function pointers for setting up TLS for all the needed Libs: in their dependency order!
- LIBIDs as #define's
Small steps (plan):
- Start with SW
- Make sure findexec is used readonly and thus is thread-safe
- Cristian makes his variant of omalloc - thread-safe
- since factory is not thread-safe and uses NTL - guard all the calls into factory with a lock: TODO for a HiWi
- the rest of our libs: libpolys, kernel, Singular (numeric?) should make use of the above "Multi-library concept":
- identify all the global variables
- Document all readonly global variables (with a single global initialization)
- Guard shared ones with locks if they are not readonly vars.
- The rest should be put into LIBTLS Structure for that lib. - but first we simply assume that we have "__thread" and mark them with this directive, maybe using a conditionaly defined macro __THREAD?