Skip to content
qPCR4vir edited this page Mar 12, 2015 · 2 revisions

Nana is a thread-safe library and accessing a widget between threads is normalized. This is a great feature that makes programmer deliver the event answer to other thread easier.

#include <nana/gui/wvl.hpp>
#include <nana/threads/pool.hpp>
void foo()
{
  //This function will be "called" in other thread created by thread pool.
}
int main()
{
  using namespace nana;
  using namespace nana::threads;
	pool thrpool;
	form fm;
	fm.events().click(pool_push(thrpool, foo));
	fm.events().click(pool_push(thrpool, []{
											  //A lambda is also allowed.
									  }));
	fm.show();
	exec();
}
Clone this wiki locally