Re: Glib::Thread::create
- From: Niko Demmel <niko demmel gmx de>
- To: Norbert Bauer <dasaspock gmx de>
- Cc: gtkmm-list gnome org
- Subject: Re: Glib::Thread::create
- Date: Sun, 29 Apr 2007 17:23:44 +0200
On 29/04/2007 14:40, Norbert Bauer wrote:
> i would like to pass an argument (a pointer) to a thread (using Glib::Thread::create).
> In the class reference there is mentioned that i can do this using sigc::bind()
>
> Has anybody a short example for me how to do this or a link to an example?
>
> I'm working under windows and use Glibmm 2.4
>
>
#include <glibmm/thread.h>
#include <iostream>
#include <string>
void thread_func(std::string s)
{
std::cout << s;
return;
}
int main(int, char**)
{
Glib::thread_init();
Glib::Thread *const my_thread = Glib::Thread::create(
sigc::bind( sigc::ptr_fun(&thread_func), "Hello World" ), true);
my_thread->join();
return 0;
}
Regards
Niko
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]