Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

unix, windows: deprecate uv_queue_work()

Rename uv_queue_work() to uv_work_queue().

Make the former an alias of the latter and tag it as deprecated.
  • Loading branch information...
commit e981721868e236fcc1fbf488b19b746ad01ccf12 1 parent b62ecda
@bnoordhuis bnoordhuis authored
View
12 include/uv.h
@@ -1360,9 +1360,17 @@ struct uv_work_s {
UV_WORK_PRIVATE_FIELDS
};
+/* Deprecated, scheduled for removal. Use uv_work_queue(). */
+UV_EXTERN UV_DEPRECATED int uv_queue_work(uv_loop_t* loop,
+ uv_work_t* req,
+ uv_work_cb work_cb,
+ uv_after_work_cb after_work_cb);
+
/* Queues a work request to execute asynchronously on the thread pool. */
-UV_EXTERN int uv_queue_work(uv_loop_t* loop, uv_work_t* req,
- uv_work_cb work_cb, uv_after_work_cb after_work_cb);
+UV_EXTERN int uv_work_queue(uv_loop_t* loop,
+ uv_work_t* req,
+ uv_work_cb work_cb,
+ uv_after_work_cb after_work_cb);
struct uv_cpu_info_s {
View
10 src/unix/threadpool.c
@@ -160,7 +160,7 @@ static void uv__queue_done(struct uv__work* w) {
}
-int uv_queue_work(uv_loop_t* loop,
+int uv_work_queue(uv_loop_t* loop,
uv_work_t* req,
uv_work_cb work_cb,
uv_after_work_cb after_work_cb) {
@@ -174,3 +174,11 @@ int uv_queue_work(uv_loop_t* loop,
uv__work_submit(loop, &req->work_req, uv__queue_work, uv__queue_done);
return 0;
}
+
+
+int uv_queue_work(uv_loop_t* loop,
+ uv_work_t* req,
+ uv_work_cb work_cb,
+ uv_after_work_cb after_work_cb) {
+ return uv_work_queue(loop, req, work_cb, after_work_cb);
+}
View
11 src/win/threadpool.c
@@ -53,7 +53,7 @@ static DWORD WINAPI uv_work_thread_proc(void* parameter) {
}
-int uv_queue_work(uv_loop_t* loop, uv_work_t* req, uv_work_cb work_cb,
+int uv_work_queue(uv_loop_t* loop, uv_work_t* req, uv_work_cb work_cb,
uv_after_work_cb after_work_cb) {
if (work_cb == NULL)
return uv__set_artificial_error(loop, UV_EINVAL);
@@ -75,3 +75,12 @@ void uv_process_work_req(uv_loop_t* loop, uv_work_t* req) {
if(req->after_work_cb)
req->after_work_cb(req);
}
+
+
+/* Deprecated. */
+int uv_queue_work(uv_loop_t* loop,
+ uv_work_t* req,
+ uv_work_cb work_cb,
+ uv_after_work_cb after_work_cb) {
+ return uv_work_queue(loop, req, work_cb, after_work_cb);
+}
View
4 test/test-threadpool.c
@@ -46,7 +46,7 @@ TEST_IMPL(threadpool_queue_work_simple) {
int r;
work_req.data = &data;
- r = uv_queue_work(uv_default_loop(), &work_req, work_cb, after_work_cb);
+ r = uv_work_queue(uv_default_loop(), &work_req, work_cb, after_work_cb);
ASSERT(r == 0);
uv_run(uv_default_loop());
@@ -62,7 +62,7 @@ TEST_IMPL(threadpool_queue_work_einval) {
int r;
work_req.data = &data;
- r = uv_queue_work(uv_default_loop(), &work_req, NULL, after_work_cb);
+ r = uv_work_queue(uv_default_loop(), &work_req, NULL, after_work_cb);
ASSERT(r == -1);
uv_run(uv_default_loop());

5 comments on commit e981721

@piscisaureus

lgtm, although I am curious why you didn't just add #define uv_queue_work uv_work_queue.

@txdv

because of ABI compatibility!

@indutny
Owner

oh gosh!

@txdv

I really don't understand why alter the name at all.
It looked fine to me: it said, queue the work!

@bnoordhuis

because of ABI compatibility!

Yes, exactly.

I really don't understand why alter the name at all.

Because I'm adding uv_work_cancel(uv_work_t*) in a follow-up commit. It may be generalized to uv_cancel(uv_req_t*) however, in which case I'll drop this commit.

Please sign in to comment.
Something went wrong with that request. Please try again.