Permalink
Browse files

Deprecate call_user_func_async() and call_user_func_array_async()

Summary:
This diff adds logic to raise a warning whenever call_user_func_async() or
call_user_func_array_async() is invoked. The warning indicates that these
functions are deprecated, and suggests that fb_call_user_func_async() or
fb_call_user_func_array_async() should be used instead.

Test Plan:
Write a small PHP program and verify the warning is raised.

Reviewed By: myang
Reviewers: myang, qigao, mwilliams, je, kma
CC: ps, mwilliams, jsobel, andrewparoski, myang
Differential Revision: 251155
  • Loading branch information...
andrewparoski authored and scottmac committed May 14, 2011
1 parent e726ea0 commit 6c59bb632eb862d7e2657d4d339a84718b52fae4
Showing with 17 additions and 5 deletions.
  1. +2 −4 doc/threading
  2. +2 −0 src/rules.mk
  3. +13 −1 src/runtime/ext/ext_function.cpp
View
@@ -56,10 +56,8 @@ please read on for call_user_func_async() series.
3. call_user_func_async() and call_user_func_array_async()
-<b>Note: This functionality is currently experimental. It has a history
-of exposing deadlocks and memory corruption in HPHP. Prefer one of the
-more mature request-based forms of concurrency delineated above where
-possible.</b>
+<b>Note: This functionality is deprecated. Please use one of the alternative
+forms of concurrency delineated above.</b>
"Fork" program into 2 or more threads at any time point of the execution from
the same set of global states, then "join" when thread finishes its execution.
View
@@ -409,6 +409,8 @@ endif
# facebook specific stuff
CPPFLAGS += -DFACEBOOK -DHAVE_QUICKLZ
+CPPFLAGS += -DCUF_ASYNC_DEPRECATION_MSG='"call_user_func_async() is deprecated, please use fb_call_user_func_async() instead"'
+CPPFLAGS += -DCUFA_ASYNC_DEPRECATION_MSG='"call_user_func_array_async() is deprecated, please use fb_call_user_func_array_async() instead"'
MYSQL_UNIX_SOCK_ADDR := $(shell mysql_config --socket)
ifneq ($(MYSQL_UNIX_SOCK_ADDR), "")
@@ -122,11 +122,23 @@ Variant f_call_user_func(int _argc, CVarRef function, CArrRef _argv /* = null_ar
}
Object f_call_user_func_array_async(CVarRef function, CArrRef params) {
- return f_call_user_func_async(0, function, params);
+#ifdef CUFA_ASYNC_DEPRECATION_MSG
+ raise_warning(CUFA_ASYNC_DEPRECATION_MSG);
+#else
+ raise_warning("call_user_func_array_async() is deprecated");
+#endif
+
+ return FiberAsyncFunc::Start(function, params);
}
Object f_call_user_func_async(int _argc, CVarRef function,
CArrRef _argv /* = null_array */) {
+#ifdef CUF_ASYNC_DEPRECATION_MSG
+ raise_warning(CUF_ASYNC_DEPRECATION_MSG);
+#else
+ raise_warning("call_user_func_async() is deprecated");
+#endif
+
return FiberAsyncFunc::Start(function, _argv);
}

0 comments on commit 6c59bb6

Please sign in to comment.