kseqpp icon indicating copy to clipboard operation
kseqpp copied to clipboard

feature request, make threads optional

Open panjea opened this issue 9 months ago • 0 comments

this is a great minimal library, thanks! it would be nice have std::thread as an ifdef option. these are my changes, not tested yet.

line 29

#ifdef KSEQPP_THREADS
  #include <thread>
#endif

line 100

#ifdef KSEQPP_THREADS
        std::thread worker;                             /**< @brief worker thread */
#endif

line 430

          inline void
        worker_join( )
        {
#ifdef KSEQPP_THREADS
          this->async_write( true );
          if ( this->worker.joinable() ) this->worker.join();
#else
          this->async_write( false );
#endif
        }

          inline void
        worker_start( )
        {
#ifdef KSEQPP_THREADS
          this->worker = std::thread( &KStream::writer, this );
#else
          this->writer();
#endif
        }

panjea avatar Sep 21 '23 17:09 panjea