Oracle Coherence for C++ API
Release 3.6.1.0

E18813-01

ThreadGroup Class Reference

#include <coherence/lang/ThreadGroup.hpp>

Inherits Object.

List of all members.


Detailed Description

ThreadGroup represents a set of threads.
Author:
mf 2009.11.17
Since:
Coherence 3.6

Public Types

typedef spec::Handle  Handle
  ThreadGroup Handle definition.
typedef spec::View  View
  ThreadGroup View definition.
typedef spec::Holder  Holder
  ThreadGroup Holder definition.

Public Member Functions

virtual String::View  getName () const
  Return the name of the group.
virtual ThreadGroup::View  getParent () const
  Return this groups parent group.
virtual void  destroy ()
  Destroy this group and all of its subgroups.
virtual bool  isDestroyed () const
  Returns true if the group has been destroyed.
virtual size32_t  activeCount (bool fRecurse=true) const
  Return an estimate as to the number of threads in the group.
virtual size32_t  activeGroupCount (bool fRecurse=true) const
  Return an estimate as to the number of thread groups in the group.
virtual size32_t  enumerateThreads (ObjectArray::Handle hao, bool fRecurse=true)
  Copy into the specified array the active threads represented by this group.
virtual size32_t  enumerateThreads (ObjectArray::Handle hao, bool fRecurse=true) const
  Copy into the specified array the active threads represented by this group.
virtual size32_t  enumerateGroups (ObjectArray::Handle hao, bool fRecurse=true)
  Copy into the specified array the active thread groups represented by this group.
virtual size32_t  enumerateGroups (ObjectArray::Handle hao, bool fRecurse=true) const
  Copy into the specified array the active thread groups represented by this group.
virtual void  interrupt (bool fRecurse=true)
  Interrupt the threads represented by this group.
virtual size32_t  join (int64_t cMillis=0, bool fRecurse=true) const
  Join the threads represented by this group.
virtual void  toStream (std::ostream &out) const
  Output a human-readable description of this Object to the given stream.

coherence::lang::operator<<(std::ostream, Object::View) is defined and will call into the toStream method, to output Objects. If a managed String object is desired, the COH_TO_STRING macro can be used to build up a String from streamable contents.

 Object::View vKey   = ...
 Object::View vValue = ...
 std::cout << vKey << " = " << vValue << std::endl;

 String::Handle hs = COH_TO_STRING(vKey << " = " << vValue);
Parameters:
out  the stream used to output the description


Protected Member Functions

  ThreadGroup (String::View vsName, ThreadGroup::Handle hParent=NULL)
  Create a new ThreadGroup.
virtual void  add (TypedHandle< Thread > hThread)
  Add a thread to this group.
virtual void  remove (TypedHandle< Thread > hThread)
  Remove a thread from this group.
virtual void  addGroup (ThreadGroup::Handle hGroup)
  Add a thread group to this group.
virtual void  removeGroup (ThreadGroup::Handle hGroup)
  Remove a thread group from this group.

Protected Attributes

FinalView< String m_vsName
  The group name.
MemberHandle
< ThreadGroup
m_hGroupParent
  The parent group.
bool  m_fDestroyed
  True if the group has been destroyed.
FinalHandle< Object m_hSetThreads
  The group's threads.
FinalHandle< Object m_hSetGroups
  The group's child groups.

Constructor & Destructor Documentation

ThreadGroup ( String::View  vsName,
ThreadGroup::Handle  hParent = NULL  
) [protected]

Create a new ThreadGroup.

Parameters:
vsName  the name for the group
hParent  the parent thread group, or NULL for current group

Member Function Documentation

virtual String::View getName (  )  const [virtual]

Return the name of the group.

Returns:
the group name

virtual ThreadGroup::View getParent (  )  const [virtual]

Return this groups parent group.

Returns:
the parent group

virtual void destroy (  )  [virtual]

Destroy this group and all of its subgroups.

The groups must be empty.

virtual bool isDestroyed (  )  const [virtual]

Returns true if the group has been destroyed.

Returns:
true if the group has been destroyed.

virtual size32_t activeCount ( bool  fRecurse = true  )  const [virtual]

Return an estimate as to the number of threads in the group.

Parameters:
fRecurse  if the count should include sub-groups
Returns:
an estimate as to the number of threads in the group

virtual size32_t activeGroupCount ( bool  fRecurse = true  )  const [virtual]

Return an estimate as to the number of thread groups in the group.

Parameters:
fRecurse  if the count should include sub-groups
Returns:
an estimate as to the number of thread groups in the group

virtual size32_t enumerateThreads ( ObjectArray::Handle  hao,
bool  fRecurse = true  
) [virtual]

Copy into the specified array the active threads represented by this group.

Parameters:
hao  the destination array
fRecurse  if sub-groups should be enumerated

virtual size32_t enumerateThreads ( ObjectArray::Handle  hao,
bool  fRecurse = true  
) const [virtual]

Copy into the specified array the active threads represented by this group.

Parameters:
hao  the destination array
fRecurse  if sub-groups should be enumerated

virtual size32_t enumerateGroups ( ObjectArray::Handle  hao,
bool  fRecurse = true  
) [virtual]

Copy into the specified array the active thread groups represented by this group.

Parameters:
hao  the destination array
fRecurse  if sub-groups should be enumerated

virtual size32_t enumerateGroups ( ObjectArray::Handle  hao,
bool  fRecurse = true  
) const [virtual]

Copy into the specified array the active thread groups represented by this group.

Parameters:
hao  the destination array
fRecurse  if sub-groups should be enumerated

virtual void interrupt ( bool  fRecurse = true  )  [virtual]

Interrupt the threads represented by this group.

Parameters:
fRecurse  if sub-groups should be enumerated

virtual size32_t join ( int64_t  cMillis = 0,
bool  fRecurse = true  
) const [virtual]

Join the threads represented by this group.

Parameters:
cMillis  the total join timeout, or zero for infinite
fRecurse  if sub-groups should be enumerated
Returns:
the number of threads which failed to join within the timeout

virtual void add ( TypedHandle< Thread hThread  )  [protected, virtual]

Add a thread to this group.

Parameters:
hThread  the thread to add

virtual void remove ( TypedHandle< Thread hThread  )  [protected, virtual]

Remove a thread from this group.

Parameters:
hThread  the thread to remove

virtual void addGroup ( ThreadGroup::Handle  hGroup  )  [protected, virtual]

Add a thread group to this group.

Parameters:
hGroup  the group to add

virtual void removeGroup ( ThreadGroup::Handle  hGroup  )  [protected, virtual]

Remove a thread group from this group.

Parameters:
hGroup  the group to remove

The documentation for this class was generated from the following file:
Copyright © 2000, 2010, Oracle and/or its affiliates. All rights reserved.