aboutsummaryrefslogtreecommitdiffstats
path: root/erts
diff options
context:
space:
mode:
authorLukas Larsson <[email protected]>2014-02-14 14:41:49 +0100
committerLukas Larsson <[email protected]>2014-02-24 15:16:07 +0100
commit0f9fd47d9141846950bd439d8401f8a759068136 (patch)
tree5d04ee6264ff7444b274bd40179b5a56f38af18c /erts
parentc6d34b4d3e6c7817d066dbe20e9c569ae332d2a6 (diff)
downloadotp-0f9fd47d9141846950bd439d8401f8a759068136.tar.gz
otp-0f9fd47d9141846950bd439d8401f8a759068136.tar.bz2
otp-0f9fd47d9141846950bd439d8401f8a759068136.zip
ose: Start using ppdata for tse key
Diffstat (limited to 'erts')
-rw-r--r--erts/include/internal/ethread.h5
-rw-r--r--erts/lib_src/ose/ethread.c13
2 files changed, 8 insertions, 10 deletions
diff --git a/erts/include/internal/ethread.h b/erts/include/internal/ethread.h
index 9b1313c538..ebddfc8ba8 100644
--- a/erts/include/internal/ethread.h
+++ b/erts/include/internal/ethread.h
@@ -728,13 +728,12 @@ ETHR_INLINE_FUNC_NAME_(ethr_leave_ts_event)(ethr_ts_event *tsep)
#if defined(ETHR_TRY_INLINE_FUNCS) || defined(ETHREAD_IMPL__)
-extern char* ethr_ts_event_key__;
+extern ethr_tsd_key ethr_ts_event_key__;
static ETHR_INLINE ethr_ts_event *
ETHR_INLINE_FUNC_NAME_(ethr_get_ts_event)(void)
{
- ethr_ts_event *tsep = (ethr_ts_event *)get_envp(current_process(),
- ethr_ts_event_key__);
+ ethr_ts_event *tsep = *(ethr_ts_event**)ose_get_ppdata(ethr_ts_event_key__);
if (!tsep) {
int res = ethr_get_tmp_ts_event__(&tsep);
if (res != 0)
diff --git a/erts/lib_src/ose/ethread.c b/erts/lib_src/ose/ethread.c
index bde85f9f87..da66c27e77 100644
--- a/erts/lib_src/ose/ethread.c
+++ b/erts/lib_src/ose/ethread.c
@@ -63,7 +63,7 @@
static ethr_tid main_thr_tid;
static const char* own_tid_key = "ethread_own_tid";
-char* ethr_ts_event_key__ = "ethread_tse";
+ethr_tsd_key ethr_ts_event_key__;
#define ETHREADWRAPDATASIG 1
@@ -173,8 +173,6 @@ static OS_PROCESS(thr_wrapper)
}
/* pthread mutex api says we have to do this */
- /*erts_fprintf(stderr, "(%s / %d) curr_pid 0x%x / signal_fsem to 0x%x (fsem val %d)\n",
- __FUNCTION__, __LINE__, current_process(), current_process(), get_fsem(current_process()));*/
signal_fsem(current_process());
ETHR_ASSERT(get_fsem(current_process()) == 0);
@@ -187,12 +185,12 @@ static OS_PROCESS(thr_wrapper)
int ethr_set_tse__(ethr_ts_event *tsep)
{
- return set_envp(current_process(),ethr_ts_event_key__, (OSADDRESS) tsep);
+ return ethr_tsd_set(ethr_ts_event_key__,(void *) tsep);
}
ethr_ts_event *ethr_get_tse__(void)
{
- return (ethr_ts_event *) get_envp(current_process(),ethr_ts_event_key__);
+ return (ethr_ts_event *) ethr_tsd_get(ethr_ts_event_key__);
}
#if defined(ETHR_PPC_RUNTIME_CONF__)
@@ -296,14 +294,15 @@ ethr_init(ethr_init_data *id)
main_thr_tid.tsd_key_index = 0;
set_envp(current_process(),own_tid_key,(OSADDRESS)&main_thr_tid);
- /*erts_fprintf(stderr, "(%s / %d) curr_pid 0x%x / signal_fsem to 0x%x (fsem_val %d)\n",
- __FUNCTION__, __LINE__, current_process(), current_process(), get_fsem(current_process()));*/
signal_fsem(current_process());
+
ETHR_ASSERT(&main_thr_tid == ETHR_GET_OWN_TID__);
ethr_not_inited__ = 0;
+ ethr_tsd_key_create(&ethr_ts_event_key__,"ethread_tse");
+
return 0;
error:
ethr_not_inited__ = 1;