Show
Ignore:
Timestamp:
08/27/08 22:02:39 (4 months ago)
Author:
frsyuki
Message:

lang/c/mpio: added mp::multiplex

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • lang/c/mpio/trunk/mp/iothreads.pre.h

    r18311 r18340  
    2121 
    2222#include "mp/blocking_vector.h" 
     23#include "mp/pthread.h" 
    2324#include "mp/source.h" 
    2425#include "mp/zone.h" 
     
    2930namespace mp { 
    3031namespace iothreads { 
    31  
    32 template <typename IMPL> 
    33 class pthread_thread { 
    34 public: 
    35         pthread_thread(IMPL* pimpl); 
    36         virtual ~pthread_thread(); 
    37 private: 
    38         pthread_t m_thread; 
    39         static void* trampoline(void* obj); 
    40 private: 
    41         pthread_thread(); 
    42         pthread_thread(const pthread_thread&); 
    43 }; 
    44  
    45 template <typename IMPL> 
    46 pthread_thread<IMPL>::pthread_thread(IMPL* pimpl) 
    47 { 
    48         pthread_create(&m_thread, NULL, 
    49                         &pthread_thread<IMPL>::trampoline, 
    50                         reinterpret_cast<void*>(pimpl)); 
    51 } 
    52  
    53 template <typename IMPL> 
    54 pthread_thread<IMPL>::~pthread_thread() {}  // FIXME 
    55  
    56 template <typename IMPL> 
    57 void* pthread_thread<IMPL>::trampoline(void* obj) 
    58 { 
    59         // FIXME exception 
    60         reinterpret_cast<IMPL*>(obj)->operator()(); 
    61         return NULL; 
    62 } 
    6332 
    6433