This is done by using a local entry array for each thread, containing
tracked blocks whose allocation callback has not yet been called.
This allows some simplification in the code running callbacks for
young allocations. Indeed, since the entry array is local to one
thread, we know for sure that it cannot be modified during a callback,
and therefore we no longer need to remember the indices of the
corresponding new entries.
Reasons:
- Better abstraction in memprof.h
- Simpler Saving/restore functions
- We introduce a current's thread context, so that we don't need to do a spacial case for the current thread
This commit adds a new thread-related module Semaphore, implementing
counting semaphores and binary semaphores.
The two kinds of semaphores are presented as two different
abstract types in two sub-modules, Counting and Binary.
- Mutex.lock raises Sys_error if the mutex is already locked by the
calling thread.
- Mutex.unlock raises Sys_error if the mutex is unlocked or locked
by another thread.
Add the corresponding tests.
Co-authored-by: David Allsopp <david.allsopp@metastack.com>
This is a wrapper around the _exit system call. It has been implemented
in otherlibs/unix/exit.c for a long time but never exported.
This commit exports and documents it as `Unix._exit`.
The Unix implementation of `establish_server` is changed to use `_exit`
and to have gender-neutral comments.
A test was added to check that OCaml finalization actions are not performed.
With this commit, it becomes possible to provide C compiler and preprocessor
flags to use in addition to those defined by the build system.
As required by the GNU coding standards, the flags can be provided
either at configure or at make invocation.
The provided CFLAGS and CPPFLAGS will also be taken into account
when C code is compiled by ocamlc/ocamlopt.
This commit removes the explicit reference to CFLAGS in the
configuration for the xlc compiler, since it is not necessary any longer.
To preserve behaviour, explicit polls are added:
- in caml_raise, to raise the right exception when as system
call is interrupted by a signal.
- in sigprocmask, to ensure that signals are handled as soon
as they are unmasked.
Now that programs are built with their $(EXE) suffix, their installation
rules can be simplified a bit because most of the programs get installed
under the name they have been built with.