Conversation
0ea5786 to
5974b67
Compare
|
Seems ok, fix minor stuff and add missing pieces (and make build green of course). Thanks |
5974b67 to
1f12b33
Compare
1f12b33 to
7c4f219
Compare
modules/gapi/src/compiler/gasync.cpp
Outdated
| mtx.lock(); | ||
| mtx.unlock(); | ||
| cv.notify_one(); | ||
| thrd.join(); |
There was a problem hiding this comment.
Be careful with waiting for notifications from worker threads during "cleanup".
Win32 ExitProcess() terminates all non-main threads unconditionally - probably with broken synchronization state - holding mutexes (user space at least) and other synchronization primitives.
And after that, it calls atexit() handlers from shared libraries, like this destructor.
Hopefully thrd.joinable() can handle that properly.
modules/gapi/src/compiler/gasync.cpp
Outdated
| } | ||
| }; | ||
|
|
||
| async_service the_ctx; |
There was a problem hiding this comment.
Probably static (or anonymous namespace)
What is about initialization "on-demand"?
static
async_service& getAsyncService()
{
static async_service g_asyncService;
return g_asyncService;
}
...
the_ctx. => getAsyncService().
There was a problem hiding this comment.
Thread It is already on created on - demand - during first call of add_task() async.cpp line 49
0b5592c to
36bdae0
Compare
|
|
||
| auto f = cv::gapi::wip::async_apply(self_mul,cv::gin(in_mat), cv::gout(out)); | ||
| f.wait(); | ||
| } |
There was a problem hiding this comment.
No comments at all. What is the general idea behind these tests?
| }; | ||
|
|
||
| async_service the_ctx; | ||
| } |
There was a problem hiding this comment.
This whole block of code still lacks comments. "What author has wanted to say?"
There was a problem hiding this comment.
see below at line 128
Is it enough - or more comments are required ?
There was a problem hiding this comment.
fixed the code and added comments
There was a problem hiding this comment.
I still don't understand what is happening here. Queue, second queue (local instance). What is the purpose of this async_service? Why it's so complicated?
There was a problem hiding this comment.
Is there any reply on @alalek's concerns regarding #14346 (comment) ?
aea3a8e to
9321944
Compare
- naive implementation as a starting point
9321944 to
adbc6d7
Compare
| #ifndef OPENCV_GAPI_GCOMPILED_ASYNC_HPP | ||
| #define OPENCV_GAPI_GCOMPILED_ASYNC_HPP | ||
|
|
||
| #include <future> |
There was a problem hiding this comment.
//for std::future
to align with next std headers comments.
| class GCompiled; | ||
|
|
||
| namespace gapi{ | ||
| namespace wip { |
There was a problem hiding this comment.
May be it worth to choose better name for namespace? Something containing "volatile".
There was a problem hiding this comment.
No, wip was my proposal (communicated to Anton "verbally")
|
|
||
| namespace gapi{ | ||
| namespace wip { | ||
| GAPI_EXPORTS void async(GCompiled& gcmpld, std::function<void(std::exception_ptr)>&& callback, GRunArgs &&ins, GRunArgsP &&outs); |
There was a problem hiding this comment.
Why do we need these overloads? Please provide comments for usage scenario for both.
| class GComputation; | ||
| namespace gapi { | ||
| namespace wip { | ||
| GAPI_EXPORTS void async_apply(GComputation& gcomp, std::function<void(std::exception_ptr)>&& callback, GRunArgs &&ins, GRunArgsP &&outs, GCompileArgs &&args = {}); |
There was a problem hiding this comment.
Again, please, provide comments regarding these overloads.
|
|
||
| #include <future> | ||
| #include <condition_variable> | ||
| //#include <chrono> |
| }; | ||
|
|
||
| async_service the_ctx; | ||
| } |
There was a problem hiding this comment.
I still don't understand what is happening here. Queue, second queue (local instance). What is the purpose of this async_service? Why it's so complicated?
| }//namespace | ||
|
|
||
| //For now these async functions are simply wrapping serial version of apply/operator() into a functor. | ||
| //These functors are then serialized into single queue, which is when processed by a devoted background thread. |
There was a problem hiding this comment.
thanks, removed
|
|
||
| auto f = cv::gapi::wip::async_apply(self_mul,cv::gin(in_mat), cv::gout(out)); | ||
| f.wait(); | ||
| } |
There was a problem hiding this comment.
No comments at all. What is the general idea behind these tests?
dmatveev
left a comment
There was a problem hiding this comment.
I think we can go ahead with these changes, since critical issues were addressed and API is more or less stabilized for external team use.
I believe Anton will handle the rest with time.
| q.swap(second_q); | ||
| lck.unlock(); | ||
|
|
||
| while (!second_q.empty()) |
There was a problem hiding this comment.
should this while condition be extended with exiting check as well?
What is the policy on exiting? Should be wait for all issues request or just "forget" it?
| }; | ||
|
|
||
| async_service the_ctx; | ||
| } |
There was a problem hiding this comment.
Is there any reply on @alalek's concerns regarding #14346 (comment) ?
|
👍 @alalek can you please proceed with merge? |
* Async API for GAPI - naive implementation as a starting point * Fix namespace comment in header
This pullrequest changes