Baigudin Software avatar
Baigudin Software logo
home
ru region
en region

Class «system::Semaphore»

Semaphore class.

public: Semaphore(int32 permits);

Constructor.

Parameters:
permits — the initial number of permits available.

public: Semaphore(int32 permits, bool isFair);

Constructor.

Parameters:
permits — the initial number of permits available.
isFair — true if this semaphore will guarantee FIFO granting of permits under contention.

public: virtual ~Semaphore();

Destructor.

public: virtual ~Semaphore();

Destructor.

public: virtual bool acquire();

Acquires one permit from this semaphore.

The method acquires one permit or waits while the permit will be released.

Returns:
true if the semaphore is acquired successfully.

public: virtual bool acquire(int32 permits);

Acquires the given number of permits from this semaphore.

The method acquires given permits number or waits while the number will be released.

Parameters:
permits — the number of permits to acquire.

Returns:
true if the semaphore is acquired successfully.

public: virtual bool isBlocked();

Tests if this resource is blocked.

Returns:
true if this resource is blocked.

public: virtual bool isConstructed() const;

Tests if this object has been constructed.

public: virtual bool isFair() const;

Tests if this semaphore is fair.

Returns:
true if this semaphore has fairness set true.

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

Tests if given object has been constructed object.

public: Object& operator =(const Object& obj);

Assignment operator.

Parameters:
obj — reference to source object.

Returns:
reference to this object.

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 release();

Releases one permit.

The method releases from one permit and returns this to the semaphore.

public: virtual void release(int32 permits);

Releases the given number of permits.

The method releases from the permits and returns these to the semaphore.

Parameters:
permits — the number of permits to release.

Back to class list