From ed188cb4dbe90d3ebb4f7f251e04b5e8d2d3c143 Mon Sep 17 00:00:00 2001 From: Tuncer Ayaz Date: Sat, 23 Jan 2010 00:16:26 +0100 Subject: Remove mutex lock around sys_gettimeofday() in os:timestamp/0 In the erlang-questions thread "os:timestamp() uses mutex lock" Jonas Falkevik questioned the need for a mutex lock in os:timestamp/0. The mutex lock *is* needed in erlang:now() to guarantee the uniqueness of the returned time, but serves no useful purpose in os:timestamp(). Signed-off-by: Tuncer Ayaz --- erts/emulator/beam/erl_time_sup.c | 4 ---- 1 file changed, 4 deletions(-) (limited to 'erts') diff --git a/erts/emulator/beam/erl_time_sup.c b/erts/emulator/beam/erl_time_sup.c index 76bfdecd9f..28bbcc15ce 100644 --- a/erts/emulator/beam/erl_time_sup.c +++ b/erts/emulator/beam/erl_time_sup.c @@ -754,12 +754,8 @@ get_sys_now(Uint* megasec, Uint* sec, Uint* microsec) { SysTimeval now; - erts_smp_mtx_lock(&erts_timeofday_mtx); - sys_gettimeofday(&now); - erts_smp_mtx_unlock(&erts_timeofday_mtx); - *megasec = (Uint) (now.tv_sec / 1000000); *sec = (Uint) (now.tv_sec % 1000000); *microsec = (Uint) (now.tv_usec); -- cgit v1.2.3