Build TOP Environments

For developer

C API

Version number
Configuration family
Reader writer lock
Named Mutex
Named condition variable

C++ API

FlShm class
FLRwlRcsv class


C API

It is an interface for C language. Include the following header file for development.

#include <fullock/fullock.h>

For the link, specify the following as an option.

-lfullock

Version number

Format

Description

Argument

Return value

None.


Configuration family

Format

Description

Return value

Returns true if it succeeds. If it fails, it returns false.

Note

The same as when reattaching “NO” to “environment variable FLCKAUTOINIT”, but the value set by functions other than fullock_reinitialize and fullock_reinitialize_ex is not reflected at that point.
After calling each function and setting the value, it is reattached to the shared memory file by calling fullock_reinitialize or fullock_reinitialize_ex.
If the file is present at the time of reattachment and another process is attached, ignoring the set value and only reattaching will be done.
If the file does not exist, a file is newly created.
If the file exists but the attached process does not exist, the file is reinitialized.
Files that were attached at the time of calling fullock_reinitialize and fullock_reinitialize_ex are only detached.


Reader writer lock

Format

Description

Argument

Return value

Note

Unlike pthread_rwlock, fullock_rwlock requests a file descriptor as a required argument and provides reader writer locking function for the file. Think of this as an alternative to fcntl.

If you want to use fullock_rwlock as a reader writer lock not related to the file descriptor, create a pseudo fd with the FLCK_RWLOCK_NO_FD macro for the fd argument and call the function. In place of the file descriptor, the lock value is distinguished by the int value specified in the FLCK_RWLOCK_NO_FD macro.


Named Mutex

Format

Description

Argument

Return value

Returns 0 if acquisition and release of lock succeed. If it can not be acquired or can not be released, it returns an error number.

Note

nothing special.


Named condition variable

Format

Description

Argument

Return value

It returns 0 if the process succeeded. Otherwise, it returns the error number.

Note

nothing special.


C++ API

It is an interface for the C ++ language.

Include the following header file for development.

#include <fullock/flckshm.h>
#include <fullock/rwlockrcsv.h>

For the link, specify the following as an option.

-lfullock

FlShm class

Operation class of reader writer lock and named mutex.

Below is a list of available methods.

Method

Description

Argument

Return value

Note


FLRwlRcsv class

It is an operation class that wraps the reader writer lock provided by FULLOCK and enables recursive locking by the same thread.
Below is a list of available methods.

Method

Description

Argument

Return value

Returns true if acquisition and release of lock succeeded. If it can not be acquired or can not be released, false is returned.

Note

This class is an operation class that wraps the reader writer lock of FULLOCK and allows recursive locking by the same thread, and even if locks are acquired from the same thread for the same file descriptor, offset, and area length, it is blocked No.
For example, it is possible to create another instance of this class in the thread that acquired the reader lock and acquire the writer lock on the same area.
Also, since the object of this class automatically releases the lock, even if the object is discarded without calling Unlock, the lock is automatically released.
As a usage method, it is possible to safely lock / unlock within the scope by simply defining this class object as an auto variable in scope in the C / C ++ language.

Build TOP Environments