Changeset 3826


Ignore:
Timestamp:
Jul 18, 2019, 8:47:27 AM (3 years ago)
Author:
Peter
Message:

function to access number of threads in Scheduler. closes #914

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/scheduler.cc

    r3682 r3826  
    5656
    5757  Scheduler scheduler(2);
     58  int n_threads = scheduler.threads();
     59  if (n_threads != 2) {
     60    suite.add(false);
     61    suite.err() << "threads(): " << n_threads << " - expected: 2\n";
     62  }
    5863  std::vector<boost::shared_ptr<Sleeper> > sleeper;
    5964  sleeper.reserve(4);
  • trunk/yat/utility/Scheduler.cc

    r3823 r3826  
    7373    throw_if_error();
    7474    data_.jobs().push(job);
     75  }
     76
     77
     78  int Scheduler::threads(void) const
     79  {
     80    return data_.threads().get();
    7581  }
    7682
  • trunk/yat/utility/Scheduler.h

    r3823 r3826  
    176176     */
    177177    void submit(const boost::shared_ptr<Job>& job);
     178
     179    /**
     180       \return number of threads used
     181
     182       \since new in yat 0.17
     183     */
     184    int threads(void) const;
    178185
    179186    /**
Note: See TracChangeset for help on using the changeset viewer.