Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

no msg

  • Loading branch information...
commit 44773cced32f61f5ce95dc55db90b3657bec6714 1 parent b222922
@echou authored
View
3  lib/eep0018/src/Makefile
@@ -1 +1,4 @@
+ERL_FILES = gen_linkedin_driver.erl \
+ eep0018.erl
+
include $(ERL_TOP)/make/app.mk
View
2  lib/eep0018/src/eep0018.erl
@@ -3,7 +3,7 @@
-behaviour(gen_linkedin_driver).
--export([start/0, start_link/0, encode/1, decode/1, test_decode/1]).
+-export([start/0, start_link/0, encode/1, decode/1]).
-export([driver_info/0]).
% callback
View
2  lib/mcache/src/Makefile
@@ -1,4 +1,4 @@
-NATIVE=1
+#NATIVE=1
APP_NAME=mcache
#ERL_COMPILE_FLAGS += -I ../include
View
51 lib/mcache/src/mcache_util.erl
@@ -2,11 +2,9 @@
%%%=========================================================================
%%% Memcached utils helper
%%%=========================================================================
--author('thijsterlouw@tencent.com').
+-author('thijsterlouw@gmail.com').
--include("webqq_log.hrl").
-
--export([now/0, hash/2, pmap/3, floor/1, ceiling/1, get_app_env/2, make_atom_name/2, make_atom_name/3, reload_config/1]).
+-export([now/0, hash/2, floor/1, ceiling/1, get_app_env/2, make_atom_name/2, make_atom_name/3, reload_config/1]).
now() ->
{MegaS, S, _MicroS} = erlang:now(),
@@ -16,56 +14,11 @@ hash(Key, crc) ->
erlang:crc32(Key);
hash(Key, erlang) ->
erlang:phash2(Key);
-hash(Key, fnv) ->
- app_nifs:fnv_hash(Key);
hash(Key, md5) ->
<<Int:32/unsigned-little-integer, _:12/binary>> = erlang:md5(Key),
Int.
-pmap(Fun, List, Timeout) ->
- Parent = self(),
- Pids =
- [
- spawn(fun() ->
- Parent ! {self(), (try Fun(Elem) catch ErrType:ErrReason -> ?DEBUG("~p pmap caught: ~p, ~p", [self(), ErrType,ErrReason]), [] end)}
- end)
- || Elem <- List
- ],
-
- [
- receive
- {Pid, Val} -> Val
- after Timeout ->
- exit(timeout)
- end
- || Pid <- Pids
- ].
-
-
-pmap3(Fun, List, Timeout) ->
- Parent = self(),
- %Pids =
- % [
- % spawn(fun() -> Parent ! {self(), (catch Fun(Elem))} end)
- % || Elem <- List
- % ],
-
- {Pids, Pid2ElemAcc} = lists:foldl(fun(Elem, {PidAcc, Pid2ElemAcc}) ->
- Pid = spawn(fun() -> Parent ! {self(), (catch Fun(Elem))} end),
- {[Pid|PidAcc], dict:store(Pid, Elem, Pid2ElemAcc)}
- end,
- {[], dict:new()},
- List),
- [
- receive
- {Pid, Val} -> Val
- after Timeout ->
- exit(timeout)
- end
- || Pid <- Pids
- ].
-
floor(X) ->
T = erlang:trunc(X),
case (X - T) of
Please sign in to comment.
Something went wrong with that request. Please try again.