I am getting acquainted with boost thread and signals. I am thus implementing this simple example, I only post the cpp file of an example class implementing a thread capable of executing a method when a Signal1 is fired. The signal is defined within a Package1Signals singleton (excuse me for these names, they have been generated from a model)

Class1.hpp

```
#ifndef CLASS1_HEADER
#define CLASS1_HEADER
#include <boost/asio/io_service.hpp>
#include <boost/asio/ip/udp.hpp>
#include <boost/asio/signal_set.hpp>
#include "Package1.hpp"
#include <boost/thread.hpp>

class Class1{
private:
    boost::asio::io_service service;
public:
    boost::thread  thread;
    Class1();
    void classifierBehavior();
    void Reception1(Signal1 signal1);
    void Reception1Behavior();
};

#endif

```

Class1.cpp

```
#include "Class1.hpp"
#include <boost/thread.hpp>
#include <boost/date_time.hpp>
#include "Package1.hpp"
#include "Package2.hpp"
#include "Package1.hpp"

Class1::Class1(){
 //boost::thread thread(boost::bind(&Class1::classifierBehavior,boost::ref(*this)));
 //thread.join();
 thread = boost::thread(&Class1::classifierBehavior,this);
};

void Class1::classifierBehavior(){
  Package1Signals::getInstance()->signal1.connect(boost::bind(&Class1::Reception1, 
  this,_1));
  service.run();

};

 void Class1::Reception1(Signal1 signal1){
std::cout<<"Signal received\n";
service.post(boost::bind(&Class1::Reception1Behavior, this));
 }

 void Class1::Reception1Behavior(){
std::cout<<"Behavior executed\n";
 }

```

Package1.hpp

```
#ifndef PACKAGE1_HEADER
#define PACKAGE1_HEADER
#include <boost/signal.hpp>

struct Signal1{   };

class Package1Signals{
private:
    Package1Signals();
    static Package1Signals * instance;
public:
    boost::signal<void(Signal1)> signal1;
    static Package1Signals * getInstance();
 };
 #endif

```

Package1.cpp

```
 #include "Package1.hpp"
 Package1Signals * Package1Signals::instance = NULL;
 Package1Signals::Package1Signals(){}
 Package1Signals * Package1Signals::getInstance(){
    if(!instance){
            instance = new Package1Signals();
        }
    return instance;
 }

```

here is the code which executes it

```
int main() {
    Class1 test;
    Package1Signals::getInstance()->signal1();
    test.thread.join();
    int k =0;
    std::cin>>k;
    return 0;
 }

```

I can see the thread runs, the signal is intercepted but the posted handler is not executed. What am I doing wrong?