Changeset 3cb97b for src


Ignore:
Timestamp:
Jul 10, 2012, 1:15:50 PM (13 years ago)
Author:
Frederik Heber <heber@…>
Children:
7ed4e8
Parents:
41f82c
git-author:
Frederik Heber <heber@…> (07/06/12 19:03:51)
git-committer:
Frederik Heber <heber@…> (07/10/12 13:15:50)
Message:

Extracted getting thread group into own function.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/bin/mpqc/mpqc.cc

    r41f82c r3cb97b  
    573573 *
    574574 * \param grp message group
    575  * \param parsedkev keyvalue container
     575 * \param parsedkev keyvalue container on return
    576576 * \param options options structure
    577577 * \param input input file name
     
    642642}
    643643
     644/** Get the thread group.
     645 *
     646 * \param keyval keyvalue container
     647 * \param thread thread group on return
     648 * \param argc argument count
     649 * \param argv argument array
     650 */
     651void getThreadGroup(
     652    Ref<KeyVal> &keyval,
     653    Ref<ThreadGrp> &thread,
     654    int argc,
     655    char **argv)
     656{
     657  //first try the commandline and environment
     658  thread = ThreadGrp::initial_threadgrp(argc, argv);
     659
     660  // if we still don't have a group, try reading the thread group
     661  // from the input
     662  if (thread.null()) {
     663    thread << keyval->describedclassvalue("thread");
     664  }
     665
     666  if (thread.nonnull())
     667    ThreadGrp::set_default_threadgrp(thread);
     668  else
     669    thread = ThreadGrp::get_default_threadgrp();
     670}
     671
    644672int
    645673try_main(int argc, char *argv[])
     
    721749  makeAnnouncement(tim);
    722750
    723   // get the thread group.  first try the commandline and environment
    724   Ref<ThreadGrp> thread = ThreadGrp::initial_threadgrp(argc, argv);
     751  // get the thread group.
     752  Ref<ThreadGrp> thread;
     753  getThreadGroup(keyval, thread, argc, argv);
    725754 
    726   // if we still don't have a group, try reading the thread group
    727   // from the input
    728   if (thread.null()) {
    729     thread << keyval->describedclassvalue("thread");
    730   }
    731 
    732   if (thread.nonnull())
    733     ThreadGrp::set_default_threadgrp(thread);
    734   else
    735     thread = ThreadGrp::get_default_threadgrp();
    736 
    737755  // get the memory group.  first try the commandline and environment
    738756  Ref<MemoryGrp> memory = MemoryGrp::initial_memorygrp(argc, argv);
Note: See TracChangeset for help on using the changeset viewer.