summaryrefslogtreecommitdiffstats
path: root/src/mutex.c
Commit message (Collapse)AuthorAgeFilesLines
* Normalize #define whitespace.Jason Evans2013-12-091-1/+1
| | | | Consistently use a tab rather than a space following #define.
* mark _pthread_mutex_init_calloc_cb as public explicitlyJan Beich2012-10-101-1/+1
| | | | | | | Mozilla build hides everything by default using visibility pragma and unhides only explicitly listed headers. But this doesn't work on FreeBSD because _pthread_mutex_init_calloc_cb is neither documented nor exposed via any header.
* Replace JEMALLOC_ATTR with various different macros when it makes senseMike Hommey2012-05-011-3/+2
| | | | | | Theses newly added macros will be used to implement the equivalent under MSVC. Also, move the definitions to headers, where they make more sense, and for some, are even more useful there (e.g. malloc).
* Add support for MingwMike Hommey2012-04-221-4/+12
|
* Postpone mutex initialization on FreeBSD.Jason Evans2012-04-041-4/+30
| | | | | Postpone mutex initialization on FreeBSD until after base allocation is safe.
* Port to FreeBSD.Jason Evans2012-02-031-5/+13
| | | | | | | | | | | | | | | | | | | | | | | | Use FreeBSD-specific functions (_pthread_mutex_init_calloc_cb(), _malloc_{pre,post}fork()) to avoid bootstrapping issues due to allocation in libc and libthr. Add malloc_strtoumax() and use it instead of strtoul(). Disable validation code in malloc_vsnprintf() and malloc_strtoumax() until jemalloc is initialized. This is necessary because locale initialization causes allocation for both vsnprintf() and strtoumax(). Force the lazy-lock feature on in order to avoid pthread_self(), because it causes allocation. Use syscall(SYS_write, ...) rather than write(...), because libthr wraps write() and causes allocation. Without this workaround, it would not be possible to print error messages in malloc_conf_init() without substantially reworking bootstrapping. Fix choose_arena_hard() to look at how many threads are assigned to the candidate choice, rather than checking whether the arena is uninitialized. This bug potentially caused more arenas to be initialized than necessary.
* Remove ephemeral mutexes.Jason Evans2012-03-241-12/+0
| | | | | | | | | | | Remove ephemeral mutexes from the prof machinery, and remove malloc_mutex_destroy(). This simplifies mutex management on systems that call malloc()/free() inside pthread_mutex_{create,destroy}(). Add atomic_*_u() for operation on unsigned values. Fix prof_printf() to call malloc_vsnprintf() rather than malloc_snprintf().
* Fix fork-related bugs.Jason Evans2012-03-131-0/+26
| | | | | | | | | Acquire/release arena bin locks as part of the prefork/postfork. This bug made deadlock in the child between fork and exec a possibility. Split jemalloc_postfork() into jemalloc_postfork_{parent,child}() so that the child can reinitialize mutexes rather than unlocking them. In practice, this bug tended not to cause problems.
* Use glibc allocator hooks.Jason Evans2012-02-291-0/+4
| | | | | | | | | | | When jemalloc is used as a libc malloc replacement (i.e. not prefixed), some particular setups may end up inconsistently calling malloc from libc and free from jemalloc, or the other way around. glibc provides hooks to make its functions use alternative implementations. Use them. Submitted by Karl Tomlinson and Mike Hommey.
* Move repo contents in jemalloc/ to top level.Jason Evans2011-04-011-0/+90