| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
| |
w/o APR_HAS_THREAD_LOCAL.
It's useless when !APR_HAS_THREAD_LOCAL since apr_thread_current() can't work.
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1908417 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
|
| |
* Introduce apr_thread_name_set() and apr_thread_name_get().
[1] https://bz.apache.org/bugzilla/show_bug.cgi?id=60587
[2] https://lists.apache.org/thread/z24logzc6v8tc0p2q3375cc10qo9y5yw
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1906889 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
| |
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1905414 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When creating a thread, this allows to specify the "max_free" of its pool
allocator (i.e. apr_allocator_max_free_set), so that one can create thread
local subpools and have their memory usage regulated on cleanup/destroy.
One could achieve that already with:
apr_allocator_max_free_set(apr_thread_pool_get(thread), max_free);
in the thread startup function, but it's more convenient, simpler and race
free to handle that in the thread attribute itself at creation time.
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1902715 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
|
| |
Fix compilation of apr_thread_current_create() for OS/2 and Windows.
Set *current to NULL on failure.
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1897879 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
|
|
|
| |
thread_local variables are not (always?) reset on fork(), so APR (and the
user) needs a way to set the current_thread to NULL.
Use apr_thread_current_after_fork() in apr_proc_fork()'s child process.
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1897470 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
| |
.. rather than a defined().
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1897447 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
| |
It's not needed, when the thread exits it's not accessible anyway.
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1897445 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
| |
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1897419 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
All modern compilers provide a Thread Local Storage keyword that allows to
store per-thread data efficiently (C++11 's thread_local, C11's _Thread_local,
gcc/clang's __thread or MSVC's __declspec(thread)).
Use that to have an apr_thread_t pointer associated with each thread created
by apr_thread_create() or any native thread (like the process' initial thread)
that registered itself with the new apr_thread_current_create() function.
This mechanism allows to implement apr_thread_current() quite efficiently, if
available, otherwise the function returns NULL.
If available APR_HAS_THREAD_LOCAL is #define'd to 1 and the APR_THREAD_LOCAL
macro is the keyword usable to register TLS variables natively.
Both APR_HAS_THREAD_LOCAL and APR_THREAD_LOCAL are #undef'ined if the compiler
does not provide the mechanism.
This allows to test for the functionality at compile time.
When APR_HAS_THREAD_LOCAL, the user can load his/her own TLS data with:
apr_thread_data_get(&my_data, my_key, apr_thread_current());
and store them with:
apr_thread_data_set(my_data, my_key, my_data_cleanup,
apr_thread_current());
which can be nice to avoid the proliferation of native TLS keys.
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1897207 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
|
| |
Make sure apr_thread_join() behaves correctly w.r.t. the returned value
and pool destroy for all archs.
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1897198 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
apr_thread_create() was allocating the created apr_thread_t on the given pool,
which caused e.g. short-living threads to leak memory on that pool without a
way to clear it (while some threads are still running).
Change this by allocating the apr_thread_t on the thread's pool itself, which
is safe in the implementations of all archs because none uses the apr_thread_t
after the thread exits, and it's safe for the users provided they don't use the
apr_thread_t for detached threads or for attached threads after the call to
apr_thread_join(). These are hardly new requirements though.
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1897197 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
r1884078 fixed lifetime issues with detached threads by using unmanaged pool
destroyed by the thread itself on exit, with no binding to the parent pool.
This commit makes use of unmanaged pools for attached threads too, they needed
their own allocator anyway due to apr_thread_detach() being callable anytime
later. apr__pool_unmanage() was a hack to detach a subpool from its parent, but
if a subpool needs its own allocator for this to work correctly there is no
point in creating a subpool for threads (no memory reuse on destroy for short
living threads for instance).
Since an attached thread has its own lifetime now, apr_thread_join() must be
called to free its resources/pool, though it's no different than before when
destroying the parent pool was UB if the thread was still running (i.e. not
joined yet).
Let's acknoledge that threads want no binding with the pool passed to them at
creation time, besides the abort_fn which they can steal :)
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1897179 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
A detached thread is by definition out of control, unjoinable, unmanaged,
and it can terminate/exit after its parent pool is detroyed.
To avoid use-after-free in this case, let's use an unmanaged pool for detached
threads, either by creating an unmanaged pool from the start if the thread
is created detached, or by "unmanaging" the pool if the thread is detached
later with apr_thread_detach().
To "umanage" the pool, provide a new internal helper, apr__pool_unmanage()
which takes care of removing the pool from its parent's list.
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1884078 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Destroying a joinable thread pool from apr_thread_exit() or when the thread
function returns, i.e. from inside the thread itself, is racy or deadlocky
with APR_POOL_DEBUG, with the parent pool being destroyed.
This commit adds a ->detached flag in each arch's apr_thread_t struct to track
whether a thread is detached (either at _create() or _detach() time). If
detached, the pool is destroyed when the thread exits, otherwise when the
thread is joined with apr_thread_join().
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1884077 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
|
|
|
|
| |
no useful (nor documented) semantic:
* include/apr_thread_proc.h (apr_thread_exit): Make void function;
mark with gcc noreturn attribute.
* threadproc/*/thread.c (apr_thread_exit): Update accordingly.
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@1862446 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
| |
platform independent macro instead of pthread
define.
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@1481265 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
| |
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@1481262 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Actually this function has been mentioned in the docs for over 10 years
but has never been implemented.
Also consistently destroy the thread's pool when it exits normally, not only
on apr_thread_exit(). This was already done on OS2.
Other platforms than unix are untested.
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@1460182 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
simplification, it fixes a compile error in the call to
pthread_yield() on z/OS.
Submitted by: David Jones
I modified it slightly to use AC_DEFINE() as suggested
by jorton.
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@596402 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
| |
Submitted by: Lucian Adrian Grijincu <lucian.grijincu gmail.com>
Reviewed by: rpluem
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@584411 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
| |
Submitted by: David Jones <oscaremma gmail.com>
Reviewed by: trawick
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@501150 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
| |
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@428317 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
| |
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@428313 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Submitted by: Keisuke Nishida <keisuke.nishida gmail.com>
Reviewed by: rooneg, Henry Jen <henryjen ztune.net>
* configure.in: Look for pthread_yield and sched_yield.
* include/arch/unix/apr_arch_threadproc.h: Include sched.h if it's present.
* threadproc/unix/thread.c
(apr_thread_yield): Actually do something in here...
* CHANGES: Note change.
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@418351 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
| |
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@151412 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
X: pass valid arguments to pthread_attr_setdetachstate.
* include/apr_thread_proc.h: Clarify apr_threadattr_detach_{set,get}
interfaces.
PR: 28472
Submitted by: INOUE Seiichiro <inoue ariel-networks.com>
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@65199 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
| |
(apr_threadattr_create): Register cleanup for threadattr object, fix
possible memory leak.
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@65195 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
the thread guard area size attribute for newly created threads.
* configure.in: Check for pthread_attr_setguardsize.
* include/apr_thread_proc.h (apr_threadattr_guardsize_set): Add
prototype.
* threadproc/unix/thread.c (apr_threadattr_guardsize_set): Add
function.
* threadproc/os2/thread.c, threadproc/win32/thread.c,
threadproc/beos/thread.c, threadproc/netware/thread.c
(apr_threadattr_guardsize_set): Add ENOTIMPL stubs.
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@65179 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
|
| |
stack size for threads created by apr_thread_create().
This is currently a not-implemented stub for BeOS.
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@64934 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
| |
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@64904 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
|
|
|
|
| |
structure in apr_threadattr_t, rather than a pointer to one.
* threadproc/unix/thread.c (apr_threadattr_create): Use a single
palloc call, omit ENOMEM handling. (apr_threadattr_detach_set,
apr_threadattr_detach_get, apr_thread_create): Adjust use of ->attr
appropriately.
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@64663 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
aix/dso.h -> -> aix/apr_arch_dso.h
beos/dso.h -> beos/apr_arch_dso.h
beos/proc_mutex.h -> beos/apr_arch_proc_mutex.h
beos/thread_cond.h -> beos/apr_arch_thread_cond.h
beos/thread_mutex.h -> beos/apr_arch_thread_mutex.h
beos/threadproc.h -> beos/apr_arch_threadproc.h
beos/thread_rwlock.h -> beos/apr_arch_thread_rwlock.h
netware/dso.h -> -> netware/apr_arch_dso.h
netware/fileio.h -> -> netware/apr_arch_fileio.h
netware/global_mutex.h -> netware/apr_arch_global_mutex.h
netware/internal_time.h -> netware/apr_arch_internal_time.h
netware/networkio.h -> netware/apr_arch_networkio.h
netware/pre_nw.h -> netware/apr_arch_pre_nw.h
netware/proc_mutex.h -> netware/apr_arch_proc_mutex.h
netware/thread_cond.h -> netware/apr_arch_thread_cond.h
netware/thread_mutex.h -> netware/apr_arch_thread_mutex.h
netware/threadproc.h -> netware/apr_arch_threadproc.h
netware/thread_rwlock.h -> netware/apr_arch_thread_rwlock.h
os2/dso.h -> os2/apr_arch_dso.h
os2/fileio.h -> os2/apr_arch_fileio.h
os2/networkio.h -> os2/apr_arch_networkio.h
os2/os2calls.h -> os2/apr_arch_os2calls.h
os2/proc_mutex.h -> os2/apr_arch_proc_mutex.h
os2/thread_cond.h -> os2/apr_arch_thread_cond.h
os2/thread_mutex.h -> os2/apr_arch_thread_mutex.h
os2/threadproc.h -> os2/apr_arch_threadproc.h
os2/thread_rwlock.h -> os2/apr_arch_thread_rwlock.h
os390/dso.h -> os390/apr_arch_dso.h
unix/dso.h -> unix/apr_arch_dso.h
unix/fileio.h -> unix/apr_arch_fileio.h
unix/global_mutex.h -> unix/apr_arch_global_mutex.h
unix/inherit.h -> unix/apr_arch_inherit.h
unix/internal_time.h -> unix/apr_arch_internal_time.h
unix/misc.h -> unix/apr_arch_misc.h
unix/networkio.h -> unix/apr_arch_networkio.h
unix/proc_mutex.h -> unix/apr_arch_proc_mutex.h
unix/shm.h -> unix/apr_arch_shm.h
unix/thread_cond.h -> unix/apr_arch_thread_cond.h
unix/thread_mutex.h -> unix/apr_arch_thread_mutex.h
unix/threadproc.h -> unix/apr_arch_threadproc.h
unix/thread_rwlock.h -> unix/apr_arch_thread_rwlock.h
win32/atime.h -> win32/apr_arch_atime.h
win32/dso.h -> win32/apr_arch_dso.h
win32/fileio.h -> win32/apr_arch_fileio.h
win32/inherit.h -> win32/apr_arch_inherit.h
win32/misc.h -> win32/apr_arch_misc.h
win32/networkio.h -> win32/apr_arch_networkio.h
win32/proc_mutex.h -> win32/apr_arch_proc_mutex.h
win32/thread_cond.h -> win32/apr_arch_thread_cond.h
win32/thread_mutex.h -> win32/apr_arch_thread_mutex.h
win32/threadproc.h -> win32/apr_arch_threadproc.h
win32/thread_rwlock.h -> win32/apr_arch_thread_rwlock.h
win32/utf8.h -> win32/apr_arch_utf8.h
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@64271 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
| |
No functional changes
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@64251 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
| |
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@63159 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
| |
"pool".
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@63158 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
| |
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@63117 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
|
|
|
| |
apr_thread_exit(..., apr_status_t retval) so that status values
can actually be returned back to apr_thread_join.
This patch converts all platforms to store the returned status
in the platform-specific opaque thread structure.
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@62670 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
| |
we try to use it.
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@62278 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
| |
(cc on Tru64 is happier now)
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@62229 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
| |
a function is only called once.
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@62227 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
| |
Submitted by: Sterling Hughes <sterling@designmultimedia.com>
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@62139 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
| |
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@62096 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
| |
then assume a status of APR_SUCCESS in apr_thread_join()
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@62070 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
| |
exit status code
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@62068 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
| |
prototype
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@62007 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
(apr_thread_start_t) two parameters, the apr private data
(apr_thread_t*) and the application private data (void*).
Applications' worker_thread() routines may use apr_thread_pool_get
to access the pool (implemented using APR_POOL_*_ACCESSOR() macros.)
Submitted by: Aaron Bannert <aaron@ebuilt.com>
Reviewed by: Will Rowe
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@61998 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
comparison of structures
add apr_os_thread_equal() and implement it on the two platforms with
apr_os_thread_current()
use apr_os_thread_equal() in the Unix lock code so we don't compare
structures
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@61768 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
been changed in my tree today :)
- remove the sms code I committed yesterday
- add an apr_pool_t to the sms structure
- add locking code to the tracking sms
This threw up an issue with locking, so next
- change the locking code to add an owner and ref counting
so we can lock multiple times from the same thread. this was
needed by the apr_sms_tracking_reset code where we lock
and then call free which locks again...
I haven't added the locking changes for os2 or win32 after
the problems I created with my last commit :)
Changes to testlock on the way.
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@61716 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
reversed.
This may have broken the Unix threaded mpm's when they started using the
bogus "set" function. A likely symptom would be failure to stop a threaded
process cleanly.
Note: it appears these functions are essentially no-ops except in Unix.
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@61495 13f79535-47bb-0310-9956-ffa450edef68
|