1st of all threads_no() returns the SIZE of the thread pool and not the "specific thread ID".
So you'll see the same number.
Where do you think you are blocked? What is the output? Are you sure the loop completes? Print something before you "post -back"
to the event loop.
I don't see any specific problem why wouldn't it work.
Artyom Beilis
--------------
CppCMS - C++ Web Framework: http://cppcms.com/
CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/
--------------------------------------------
On Wed, 7/16/14, DieterM75 . <die...@gm...> wrote:
Subject: Re: [Cppcms-users] Asynchronous app calls thread_pool.post() and blocks current thread
To: "Artyom Beilis" <art...@ya...>, cpp...@li...
Date: Wednesday, July 16, 2014, 10:18 PM
Sure,
I want an asynchronous application to
handle some requests assigned to the dispatcher.
Then for each request, a long running
task is to be created. Therefore I want it to be executed
not in the event loop and block the complete process.
What I thought would happen was the
jop posted via thread_pool().post would have been executed
in a thread from the pool, not blocking the event loop nor
the request handling.
What I encounter
is that the asynchronous application is not able to handle
further requests while the first job is running, but rather
enques them and processes them one after another.
However, a timer I implemented with boosters
deadline_timer is continuously triggering (not included in
the code). So I guess the event loop is not blocked, but the
application is.
On Wed, Jul 16, 2014 at
9:34 AM, Artyom Beilis <art...@ya...>
wrote:
Can you please send
the code via attachment/inline and not "pastie"
and explain in more details what happens?
Artyom Beilis
--------------
CppCMS - C++ Web Framework: http://cppcms.com/
CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/
From: dieterm57 <die...@gm...>
To: cpp...@li...
Sent: Monday,
July 14, 2014 10:34 PM
Subject: [Cppcms-users]
Asynchronous app calls thread_pool.post() and blocks current
thread
Hey all,
I try to run an
eventhandler inside of an asynchronous application,
using the following code:
http://pastie.org/private/9kuhjwvrzswmnpoczvvqw
This seems to not block the eventloop, but
the eventhandler gets called
in the same
thread the application runs in, resulting in the
application
not responding to new incoming
requests.
Is this the way
it is designed or am I screwing up again :-[ ?
What would be the correct application design to execute a
'background'
job in the thread_pool,
while not blocking the incoming requests?
Sincerely
Dieter
------------------------------------------------------------------------------
Want fast and easy access to all the code in your
enterprise? Index and
search up to 200,000
lines of code with a free copy of Black Duck®
Code Sight™ - the same
software that powers the world's largest code
search on Ohloh, the Black Duck Open Hub! Try
it now.
http://p.sf.net/sfu/bds
_______________________________________________
Cppcms-users mailing list
Cpp...@li...
https://lists.sourceforge.net/lists/listinfo/cppcms-users
------------------------------------------------------------------------------
Want fast and easy access to all the code in your
enterprise? Index and
search up to 200,000 lines of code with a free copy of Black
Duck
Code Sight - the same software that powers the world's
largest code
search on Ohloh, the Black Duck Open Hub! Try it now.
http://p.sf.net/sfu/bds
_______________________________________________
Cppcms-users mailing list
Cpp...@li...
https://lists.sourceforge.net/lists/listinfo/cppcms-users
|