[omniORB] Array of omni_condition objects?

David Riddoch djr@uk.research.att.com
Tue, 28 Mar 2000 11:01:34 +0100 (BST)


On Tue, 28 Mar 2000, Johannes van Jaarsveld wrote:

> In the example diner.cc it follows:
> 
>         static omni_mutex chopsticks[N_DINERS];
> 
> What I want to know is how to declare a corresponding array of
> omni_condition type objects with each of the constructors given a pointer
> to the corresponding mutex objects declared above (according to index
> numbers).

Can't be done, since there is no default constructor for omni_condition
objects.  However, you could have an array of mutex/condition pairs as
follows:

class mt_cv_pair {
public:
  inline mt_cv_pair() : pd_c(&pd_m) {}

  omni_mutex     pd_m;
  omni_condition pd_c;
};

static mt_cv_pair whatever[some_number];


Hope that helps,
David