Previous Up Next

Module ThreadGroup

module ThreadGroup: sig .. end
Thread groups.

type t = java'lang'ThreadGroup java_instance
The type of thread groups, that are sets of threads organized into a hierarchy (every group except the initial one has a parent).

Threads are added to a group at creation time and cannot change group afterwards.
val make : ?parent:t -> JavaString.t -> t
Returns a new group with optional parent, and name; see ThreadGroup(...) .
val active_count : t -> java_int
Returns the number of active threads in this group (including children groups); see activeCount(...) .
val active_group_count : t -> java_int
Returns the number of active groups in this group (including children groups); see activeGroupCount(...) .
val destroy : t -> unit
Destroys the passed group and all its children groups; see destroy(...) .
Raises Java_exception if the thread group is not empty, or has already been destroyed
val get_max_priority : t -> java_int
Returns the maximum priority of the group; see getMaxPriority(...) .
val get_name : t -> JavaString.t
Returns the name of the group; see getName(...) .
val get_parent : t -> t
Returns the parent of the group, null if no such group exists; see getParent(...) .
val interrupt : t -> unit
Interrupts all thread in the group (including children groups); see interrupt(...) .
val is_daemon : t -> bool
Tests whether the group is a daemon one; see isDaemon(...) .
val is_destroyed : t -> bool
Tests whether the group has been destroyed; see isDestroyed(...) .
val parent_of : t -> t -> bool
parent_of p c tests whether p is an ancestor of c; see parentOf(...) .
val set_daemon : t -> bool -> unit
Sets the daemon status of the group. Daemon groups are automatically destroyed when they have neither child group, nor running thread; see setDaemon(...) .
val set_max_priority : t -> java_int -> unit
Sets the maximum priority of the group; see setMaxPriority(...) .
val enumerate_threads : t ->
?recurse:bool -> java'lang'Thread java_instance JavaReferenceArray.t -> int32
Enumerates (recursively by default) the threads in the group by storing them in the passed array, and returning the number of actually stored threads; see enumerate(...) .
val enumerate_groups : t ->
?recurse:bool ->
java'lang'ThreadGroup java_instance JavaReferenceArray.t -> int32
Enumerates (recursively by default) the groups in the group by storing them in the passed array, and returning the number of actually stored groups; see enumerate(...) .

Null value

val null : t
The null value.
val is_null : t -> bool
is_null obj returns true iff obj is equal to null.
val is_not_null : t -> bool
is_not_null obj returns false iff obj is equal to null.

Miscellaneous

val wrap : t -> t option
wrap obj wraps the reference obj into an option type:
  • Some x if obj is not null;
  • None if obj is null.

val unwrap : t option -> t
unwrap obj unwraps the option obj into a bare reference:
  • Some x is mapped to x;
  • None is mapped to null.

AltStyle によって変換されたページ (->オリジナル) /