Baigudin Software avatar
Baigudin Software logo
home
ru region
en region

Class «core::Thread»

Thread class.

public: Thread();

Constructor.

Constructs this thread as the task for executing.

public: Thread(::api::Task& target);

Constructor.

Parameters:
target — an task interface whose main method is invoked when this thread is started.

public: virtual ~Thread();

Destructor.

public: static void block(::api::Resource& res);

Blocks current thread on given resource and yields the task.

Parameters:
res — reference to resource.

public: static ::core::Thread& currentThread();

Returns the currently executing thread.

Returns:
the executable thread.

public: virtual int64 getId();

Returns the identifier of this thread.

Returns:
the thread identifier.

public: virtual int32 getPriority() const;

Returns this thread priority.

Returns:
priority value.

public: static ::api::Toggle& global();

Returns the toggle interface for controlling global thread switch.

Returns:
toggle interface.

public: virtual bool isConstructed() const;

Tests if this object has been constructed.

Returns:
true if object has been constructed successfully.

public: static bool isObject(const Type* obj);

Tests if given object has been constructed object.

Parameters:
obj — pointer to object.

Returns:
true if object has been constructed successfully.

public: virtual void join();

Waits for this thread to die.

public: virtual void main();

The method with self context

public: void operator delete(void* ptr);

Operator delete.

Parameters:
ptr — address of allocated memory block or a null pointer.

public: void* operator new(size_t size);

Operator new.

Parameters:
size — number of bytes to allocate.

Returns:
allocated memory address or a null pointer.

public: void* operator new(size_t size, void* ptr);

Operator new.

Parameters:
size — unused.
ptr — pointer to reserved memory area

Returns:
given pointer.

public: virtual void setPriority(int32 priority);

Sets this thread priority.

Parameters:
priority — number of priority in range [MIN_PRIORITY, MAX_PRIORITY].

public: static void sleep(int64 millis, int32 nanos=0);

Causes the currently executing thread to sleep.

Parameters:
millis — a time to sleep in milliseconds.
nanos — an additional nanoseconds to sleep.

public: virtual int32 stackSize();

Returns size of stack.

The method returns size of stack in bytes which should be allocated for the task.

Returns:
stack size in bytes.

public: virtual void start();

Causes this thread to begin execution.

public: static void yield();

Yields to next thread.

protected: static Type alloc(size_t size);

Allocates memory.

Parameters:
size — number of bytes to allocate.

Returns:
allocated memory address or a null pointer.

protected: static void free(void* ptr);

Frees an allocated memory.

Parameters:
ptr — address of allocated memory block or a null pointer.

protected: virtual void setConstruct(bool flag);

Sets the object constructed flag.

Parameters:
flag — constructed flag.

Back to class list