Source

mana-core-athenamp / src / _athenamp / AthenaMP / ProcessGroup.h

#ifndef ATHENAMP_PROCESSGROUP_H
#define ATHENAMP_PROCESSGROUP_H

#include "AthenaMP/Process.h"
#include <vector>


namespace AthenaMP {

struct ProcessResult {
   pid_t pid;
   int   exitcode;
};

class ProcessGroup {
public:
   explicit ProcessGroup( int nprocs = -1 );
   virtual ~ProcessGroup();

   pid_t getGroupID() const;

   int map_async( const std::string& func );
   int wait( std::vector< ProcessResult >& status, int options = 0 );

// the following should be temporary (is needed for the python
// interface, but it is better broken up into the actual needs)
   const std::vector< Process >& getChildren() const;

private:
   bool create();

private:
   std::vector< Process > m_processes;
   int m_nprocs;
   pid_t m_pgid;
};

} // namespace AthenaMP

#endif // !ATHENAMP_PROCESSGROUP_H