The Pthreads Library Module (f_pthread) is a Fortran 90 module that defines data types and routines to make it easier to interface with the Linux pthreads library. The Linux pthreads library is used to parallelize and thread-safe your code. The f_pthread library module naming convention is the use of the prefix f_ before the corresponding Linux pthreads library routine name or type definition name.
In general, there is a one-to-one corresponding relationship between the procedures in the Fortran 90 module f_pthread and the library routines contained in the Linux pthreads library. However, some of the pthread routines have no corresponding procedures in this module because they are not supported on Linux. One example of these routines is the thread stack address option. There are also some non-pthread interfacing routines contained in the f_pthread library module. The f_maketime routine is one example and is included to return an absolute time in a f_timespec derived type variable.
Most of the routines return an integer value. A return value of 0 will always indicate that the routine call did not result in any error. Any non-zero return value indicates an error. Each error code has a corresponding definition of a system error code in Fortran. These error codes are available as Fortran integer constants. The naming of these error codes in Fortran is consistent with the corresponding Linux error code names. For example, EINVAL is the Fortran constant name of the error code EINVAL on Linux. For a complete list of these error codes, refer to the file /usr/include/errno.h on Linux.
This function accepts an integer value specifying a delay in seconds and returns an f_timespec type object containing the absolute time, which is delay seconds from the calling moment.
Function
TYPE (f_timespec)
The absolute time, which is delay seconds from the calling moment, is returned.
This function must be called to destroy any previously initialized thread attribute objects when they will no longer be used. Threads that were created with this attribute object will not be affected in any way by this action. Memory that was allocated when it was initialized will be recollected by the system.
Function
INTEGER(4)
On successful completion, this function returns 0. Otherwise, this function returns the following error.
This function can be used to query the setting of the detach state attribute in the thread attribute object attr. The current setting will be returned through argument detach.
Function
Contains one of the following values:
INTEGER(4)
On successful completion, this function returns 0. Otherwise, this function returns the following error:
This function is used to get the guardsize attribute in the thread attribute object attr. The current setting of the attribute will be returned through the argument guardsize.
Function
INTEGER(4)
On successful completion, this function returns 0. Otherwise, this function returns the following error:
This function can be used to query the inheritance scheduling attribute in the thread attribute object attr. The current setting will be returned through the argument inherit.
Function
On return from the function, inherit contains one of the following values:
INTEGER(4)
On successful completion, this function returns 0. Otherwise this function returns the following error.
This function can be used to query the scheduling property setting in the thread attribute object attr. The current setting will be returned in the argument param.
Function
INTEGER(4)
On successful completion, this function returns 0. Otherwise, this function returns the following error.
This function can be used to query the scheduling policy attribute setting in the attribute object attr. The current setting of the scheduling policy will be returned in the argument policy.
Function
INTEGER(4)
On successful completion, this function returns 0. Otherwise, this function returns the following error.
This function can be used to query the current setting of the scheduling scope attribute in the thread attribute object attr. The current setting will be returned through the argument scope.
Function
On return from the function, scope will contain one of the following values:
INTEGER(4)
On successful completion, this function returns 0. Otherwise, this function returns the following error.
Retrieves the values of the stackaddr and stacksize arguments from the thread attribute object attr.
Function
INTEGER(4)
On successful completion, this function returns 0. Otherwise, this function returns the following error.
This function must be called to create and initialize the pthread attribute object attr before it can be used in any way. It will be filled with system default thread attribute values. After it is initialized, certain pthread attributes can be changed and/or set through attribute access procedures. Once initialized, this attribute object can be used to create a thread with the intended attributes.
Function
INTEGER(4)
On successful completion, this function returns 0. Otherwise, this function returns the following error.
Function
Must contain one of the following values:
INTEGER(4)
On successful completion, this function returns 0. Otherwise, this function returns the following error.
This function is used to set the guardsizeattribute in the thread attributes object attr. The new value of this attribute is obtained from the argument guardsize. If guardsize is zero, a guard area will not be provided for threads created with attr. If guardsize is greater than zero, a guard area of at least sizeguardsize bytes is provided for each thread created with attr.
Function
INTEGER(4)
On successful completion, this function returns 0. Otherwise, this function returns the following error.
This function can be used to set the inheritance attribute of the thread scheduling property in the thread attribute object attr.
Function
Must contain one of the following values:
INTEGER(4)
On successful completion, this function returns 0. Otherwise, this function returns the following error.
This function can be used to set the scheduling property attribute in the thread attribute object attr. Threads created with this new attribute object will assume the scheduling property of argument param if they are not inherited from the creating thread. The sched_priority field in argument param indicates the thread's scheduling priority. The priority field must assume a value in the range of 1-127, where 127 is the most favored scheduling priority while 1 is the least.
Function
INTEGER(4)
On successful completion, this function returns 0. Otherwise, this function returns the following error.
After the attribute object is set by this function, threads created with this attribute object will assume the set scheduling policy if the scheduling property is not inherited from the creating thread.
Function
Must contain one of the following values:
INTEGER(4)
On successful completion, this function returns 0. Otherwise, this function returns one of the following error.
This function can be used to set the contention scope attribute in the thread attribute object attr.
Argument scope must contain one of the following values:
Function
Must contain one of the following values:
INTEGER(4)
On successful completion, this function returns 0. Otherwise, this function returns the following error.
Use this function to set the stack address and stack size attributes in the pthread attribute object attr. The stackaddr argument represents the stack address as an Integer pointer. The stacksize argument is an integer that represents the size of the stack in bytes. When creating a thread using the attribute object attr, the system allocates a minimum stack size of stacksize bytes.
Function
INTEGER(4)
On successful completion, this function returns 0. Otherwise, this function returns one of the following errors.
A derived data type whose components are all private. Any object of this type should be manipulated only through the appropriate interfaces provided in this module.
This data type corresponds to the POSIX pthread_attr_t, which is the type of thread attribute object.
Data Type.
This function can be used to cancel a target thread. How this cancelation request will be processed depends on the state of the cancelability of the target thread. The target thread is identified by argument thread. If the target thread is in deferred-cancel state, this cancelation request will be put on hold until the target thread reaches its next cancelation point. If the target thread disables its cancelability, this request will be put on hold until it is enabled again. If the target thread is in async-cancel state, this request will be acted upon immediately.
Function
INTEGER(4)
On successful completion, this function returns 0. Otherwise, this function returns the following error.
This subroutine should be paired with f_pthread_cleanup_push in using the cleanup stack for thread safety. If the supplied argument exec contains a non-zero value, the last pushed cleanup function will be popped from the cleanup stack and executed, with the argument arg (from the last f_pthread_cleanup_push) passed to the cleanup function.
If exec contains a zero value, the last pushed cleanup function will be popped from the cleanup stack, but will not be executed.
Subroutine
None.
None.
This function can be used to register a cleanup subroutine for the calling thread. In case of an unexpected termination of the calling thread, the system will automatically execute the cleanup subroutine in order for the calling thread to terminate safely. The argument cleanup must be a subroutine expecting exactly one argument. If it is executed, the argument arg will be passed to it as the actual argument.
The argument arg is a generic argument that can be of any type and any rank. The actual argument arg must be a variable, and consequently eligible as a left-value in an assignment statement. If you pass an array section with vector subscripts to the argument arg, the result is unpredictable.
If the actual argument arg is an array section, the corresponding dummy argument in subroutine cleanup must be an assumed-shape array. Otherwise, the result is unpredictable.
If the actual argument arg has the pointer attribute that points to an array or array section, the corresponding dummy argument in subroutine cleanup must have a pointer attribute or be an assumed-shape array. Otherwise, the result is unpredictable.
For a normal execution path, this function must be paired with a call to f_pthread_cleanup_pop.
The argument flag must be used to convey the property of argument arg exactly to the system.
Function
INTEGER(4)
On successful completion, this function returns 0. Otherwise, this function returns one of the following errors.
This function will unblock all threads waiting on the condition variable cond. If there is no thread waiting on this condition variable, the function will still succeed, but the next caller to f_pthread_cond_wait will be blocked, and will wait on the condition variable cond.
Function
INTEGER(4)
On successful completion, this function returns 0. Otherwise, this function returns following error.
This function can be used to destroy those condition variables that are no longer required. The target condition variable is identified by the argument cond. System resources allocated during initialization will be recollected by the system.
Function
INTEGER(4)
On successful completion, this function returns 0. Otherwise, this function returns the following error.
This function can be used to dynamically initialize a condition variable cond. Its attributes will be set according to the attribute object cattr, if it is provided; otherwise, its attributes will be set to the system default. After the condition variable is initialized successfully, it can be used to synchronize threads.
Another method of initializing a condition variable is to initialize it statically using the Fortran constant PTHREAD_COND_INITIALIZER.
Function
INTEGER(4)
On successful completion, this function returns 0. Otherwise, this function returns one of the following errors.
This function will unblock at least one thread waiting on the condition variable cond. If there is no thread waiting on this condition variable, the function will still succeed, but the next caller to f_pthread_cond_wait will be blocked, and will wait on the condition variable cond.
Function
INTEGER(4)
On successful completion, this function returns 0. Otherwise, this function returns the following error.
A derived data type whose components are all private. Any object of this type should be manipulated through the appropriate interfaces provided in this module. In addition, objects of this type can be initialized at compile time using the Fortran constant PTHREAD_COND_INITIALIZER.
This data type corresponds to the POSIX pthread_cond_t, which is the type of condition variable object.
Data Type.
This function can be used to wait for a certain condition to occur. The argument mutex must be locked before calling this function. The mutex is unlocked atomically and the calling thread waits for the condition to occur. The argument timeout specifies a deadline before which the condition must occur. If the deadline is reached before the condition occurs, the function will return an error code. This function provides a cancelation point in that the calling thread can be canceled if it is in the enabled state.
The argument timeout will specify an absolute date of the form: Oct. 31 10:00:53, 1998. For related information, see f_maketime and f_timespec.
Function
INTEGER(4)
On successful completion, this function returns 0. Otherwise this function returns one of the following errors:
This function can be used to wait for a certain condition to occur. The argument mutex must be locked before calling this function. The mutex is unlocked atomically, and the calling thread waits for the condition to occur. If the condition does not occur, the function will wait until the calling thread is terminated in another way. This function provides a cancelation point in that the calling thread can be canceled if it is in the enabled state.
Function
INTEGER(4)
This function returns 0.
This function can be called to destroy the condition variable attribute objects that are no longer required. The target object is identified by the argument cattr. The system resources allocated when it is initialized will be recollected.
Function
INTEGER(4)
On successful completion, this function returns 0. Otherwise, this function returns on of the following errors.
This function can be used to query the process-shared attribute of the condition variable attributes object identified by the argument cattr. The current setting of this attribute will be returned in the argument pshared.
Function
On successful completion, pshared contains one of the following values:
INTEGER(4)
On successful completion, this function returns 0. Otherwise, this function returns the following error.
Use this function to initialize a condition variable attributes object cattr with the default value for all of the attributes defined by the implementation. Attempting to initialize an already initialized condition variable attributes object results in undefined behavior. After a condition variable attributes object has been used to initialize one or more condition variables, any function affecting the attributes object (including destruction) does not affect any previously initialized condition variables.
Function
INTEGER(4)
On successful completion, this function returns 0. Otherwise, this function returns the following error.
This function is used to set the process-shared attribute of the condition variable attributes object identified by the argument cattr. Its process-shared attribute will be set according to the argument pshared.
Function
INTEGER(4)
On successful completion, this function returns 0. Otherwise, this function returns the following error.
A derived data type whose components are all private. Any object of this type should be manipulated only through the appropriate interfaces provided in this module.
This data type corresponds to the POSIX pthread_condattr_t, which is the type of condition variable attribute object.
Data Type
This function is used to create a new thread in the current process. The newly created thread will assume the attributes defined in the thread attribute object attr, if it is provided. Otherwise, the new thread will have system default attributes. The new thread will begin execution at the subroutine ent, which is required to have one dummy argument. The system will pass the argument arg to the thread entry subroutine ent as its actual argument. The argument flag is used to inform the system of the property of the argument arg. When the execution returns from the entry subroutine ent, the new thread will terminate automatically.
If subroutine ent was declared such that an explicit interface would be required if it was called directly, then an explicit interface is also required when it is passed as an argument to this function.
The argument arg is a generic argument that can be of any type and any rank. The actual argument arg must be a variable, and consequently eligible as a left- value in an assignment statement. If you pass an array section with vector subscripts to the argument arg, the result is unpredictable.
If the actual argument arg is an array section, the corresponding dummy argument in subroutine ent must be an assumed-shape array. Otherwise, the result is unpredictable.
If the actual argument arg has the pointer attribute that points to an array or array section, the corresponding dummy argument in subroutine ent must have a pointer attribute or be an assumed-shape array. Otherwise, the result is unpredictable.
Function
On successful completion of the function, f_pthread_create stores the ID of the created thread in the thread.
The argument flag must convey the property of the argument arg exactly to the system. The argument flag can be one of, or a combination of, the following constants:
INTEGER(4)
On successful completion, this function returns 0. Otherwise, this function returns one of the following errors.
This function is used to indicate to the pthreads library implementation that storage for the thread whose thread ID is specified by the argument thread can be claimed when this thread terminates. If the thread has not yet terminated, f_pthread_detach shall not cause it to terminate. Multiple f_pthread_detach calls on the same target thread cause an error.
Function
INTEGER(4)
On successful completion, this function returns 0. Otherwise, this function returns the following error.
Function
LOGICAL(4)
This subroutine can be called explicitly to terminate the calling thread before it returns from the entry subroutine. The actions taken depend on the state of the calling thread. If it is in non-detached state, the calling thread will wait to be joined. If the thread is in detached state, or when it is joined by another thread, the calling thread will terminate safely. First, the cleanup stack will be popped and executed, and then any thread-specific data will be destructed by the destructors. Finally, the thread resources are freed and the argument ret will be returned to the joining threads. The argument ret of this subroutine is optional. Currently, argument ret is limited to be an Integer pointer. If it is not an Integer pointer, the behavior is undefined.
This subroutine never returns. If argument ret is not provided, NULL will be provided as this thread's exit status.
Subroutine
None
None
This function returns the value of the concurrency level set by a previous call to the f_pthread_setconcurrency function. If the f_pthread_setconcurrency function was not previously called, this function returns zero to indicate that the system is maintaining the concurrency level.
Function
None
INTEGER(4)
This function returns the value of the concurrency level set by a previous call to the f_pthread_setconcurrency function. If the f_pthread_setconcurrency function was not previously called, this function returns 0.
This function can be used to query the current setting of the scheduling property of the target thread. The target thread is identified by argument thread. Its scheduling policy will be returned through argument policy and its scheduling property through argument param. The sched_priority field in param defines the scheduling priority. The priority field will assume a value in the range of 1-127, where 127 is the most favored scheduling priority while 1 is the least.
Function
INTEGER(4)
On successful completion, this function returns 0. Otherwise, this function returns one of the following errors.
This function can be used to retrieve the thread-specific data associated with key. Note that the argument arg is not optional in this function as it will return the thread-specific data. After execution of the procedure, the argument arg holds a pointer to the data, or NULL if there is no data to retrieve. The argument arg must be an Integer pointer, or the result is undefined.
The actual argument arg must be a variable, and consequently eligible as a left-value in an assignment statement. If you pass an array section with vector subscripts to the argument arg, the result is unpredictable.
Function
INTEGER(4)
On successful completion, this function returns 0. Otherwise, this function returns the following error.
This function can be called to join a particular thread designated by the argument thread. If the target thread is in non-detached state and is already terminated, this call will return immediately with the target thread's status returned in argument ret if it is provided. The argument ret is optional. Currently, ret must be an Integer pointer if it is provided.
If the target thread is in detached state, it is an error to join it.
Function
INTEGER(4)
On successful completion, this function returns 0. Otherwise, this function returns one of the following errors.
This function can be used to acquire a thread-specific data key. The key will be returned in the argument key. The argument dtr is a subroutine that will be used to destruct the thread-specific data associated with this key when any thread terminates after this calling point. The destructor will receive the thread-specific data as its argument. The destructor itself is optional. If it is not provided, the system will not invoke any destructor on the thread-specific data associated with this key. Note that the number of thread-specific data keys is limited in each process. It is the user's responsibility to manage the usage of the keys. The per-process limit can be checked by the Fortran constant PTHREAD_DATAKEYS_MAX.
Function
INTEGER(4)
On successful completion, this function returns 0. Otherwise, this function returns one of the following errors.
This function will destroy the thread-specific data key identified by the argument key. It is the user's responsibility to ensure that there is no thread-specific data associated with this key. This function does not call any destructor on the thread's behalf. After the key is destroyed, it can be reused by the system for f_pthread_key_create requests.
Function
INTEGER(4)
On successful completion, this function returns 0. Otherwise, this function returns one of the following errors.
A derived data type whose components are all private. Any object of this type should be manipulated only through the appropriate interfaces provided in this module.
This data type corresponds to the POSIX pthread_key_t, which is the type of key object for accessing thread-specific data.
Data Type
This function can be used to send a signal to a target thread. The target thread is identified by argument thread. The signal which will be sent to the target thread is identified in argument sig. If sig contains value zero, error checking will be done by the system but no signal will be sent.
Function
INTEGER(4)
On successful completion, this function returns 0. Otherwise, this function returns one of the following errors.
This function should be called to destroy those mutex objects that are no longer required. In this way, the system can recollect the memory resources. The target mutex object is identified by the argument mutex.
Function
INTEGER(4)
On successful completion, this function returns 0. Otherwise, this function returns one of the following errors.
This function can be used to initialize the mutex object identified by argument mutex. The initialized mutex will assume attributes set in the mutex attribute object mattr, if it is provided. If mattr is not provided, the system will initialize the mutex to have default attributes. After it is initialized, the mutex object can be used to synchronize accesses to critical data or code. It can also be used to build more complicated thread synchronization objects.
Another method to initialize mutex objects is to statically initialize them through the Fortran constant PTHREAD_MUTEX_INITIALIZER. If this method of initialization is used it is not necessary to call the function before using the mutex objects.
Function
INTEGER(4)
This function always returns 0.
This function can be used to acquire ownership of the mutex object. (In other words, the function will lock the mutex.) If the mutex has already been locked by another thread, the caller will wait until the mutex is unlocked. If the mutex is already locked by the caller itself, an error will be returned to prevent recursive locking.
Function
INTEGER(4)
On successful completion, this function returns 0. Otherwise, this function returns one of the following errors.
A derived data type whose components are all private. Any object of this type should be manipulated through the appropriate interfaces provided in this module. In addition, objects of this type can be initialized statically through the Fortran constant PTHREAD_MUTEX_INITIALIZER.
This data type corresponds to the POSIX pthread_mutex_t, which is the type of mutex object.
Data Type
This function can be used to acquire ownership of the mutex object. (In other words, the function will lock the mutex.) If the mutex has already been locked by another thread, the function returns the error code EBUSY. The calling thread can check the return code to take further actions. If the mutex is already locked by the caller itself, an error will be returned to prevent recursive locking.
Function
INTEGER(4)
On successful completion, this function returns 0. Otherwise, this function returns one of the following errors.
This function releases the mutex object's ownership in order to allow other threads to lock the mutex.
Function
INTEGER(4)
On successful completion, this function returns 0. Otherwise, this function returns one of the following errors.
This function can be used to destroy a mutex attribute object that has been initialized previously. Allocated memory will then be recollected. A mutex created with this attribute will not be affected by this action.
Function
INTEGER(4)
This function always returns 0.
This function is used to query the process-shared attribute in the mutex attributes object identified by the argument mattr. The current setting of the attribute will be returned through the argument pshared.
Function
INTEGER(4), INTENT(IN)
On return from this function, psharedcontains one of the following values:
INTEGER(4)
If this function completes successfully, value 0 is returned and the value of the process-shared attribute is returned through the argument pshared. Otherwise, the following error will be returned:
This function is used to query the mutex type attribute in the mutex attributes object identified by the argument mattr.
If this function completes successfully, value 0 is returned and the type attribute will be returned through the argument type.
Function
On return from this function, type contains one of the following values:
INTEGER(4)
On successful completion, this function returns 0. Otherwise, this function returns the following error.
This function can be used to initialize a mutex attribute object before it can be used in any other way. The mutex attribute object will be returned through argument mattr.
Function
INTEGER(4)
This function returns 0.
This function is used to set the process-shared attribute of the mutex attributes object identified by the argument mattr.
Function
INTEGER(4), INTENT(IN)
Must contain one of the following values:
INTEGER(4)
On successful completion, this function returns 0. Otherwise, this function returns the following error.
This function is used to set the mutex type attribute in the mutex attributes object identified by the argument mattr The argument type identifies the mutex type attribute to be set.
Function
Must contain one of the following values:
INTEGER(4)
On successful completion, this function returns 0. Otherwise, this function returns the following error.
A derived data type whose components are all private. Any object of this type should be manipulated only through the appropriate interfaces provided in this module.
This data type corresponds to the POSIX pthread_mutexattr_t, which is the type of mutex attribute object.
Data Type
This function can be used to initialize those data required to be initialized only once. The first thread calling this function will call initr to do the initialization. Other threads calling this function afterwards will have no effect. Argument initr must be a subroutine without dummy arguments.
Function
INTEGER(4)
This function returns 0.
A derived data type whose components are all private. Any object of this type should be manipulated through the appropriate interfaces provided in this module. However, objects of this type can only be initialized through the Fortran constant PTHREAD_ONCE_INIT.
Data Type
This function destroys the read-write lock object specified by the argument rwlock and releases any resources used by the lock.
Function
INTEGER(4)
On successful completion, this function returns 0. Otherwise, this function returns one of the following errors.
This function initializes the read-write lock object specified by rwlock with the attribute specified by the argument rwattr. If the optional argument rwattr is not provided, the system will initialize the read-write lock object with the default attributes. After it is initialized, the lock can be used to synchronize access to critical data. With a read-write lock, many threads can have simultaneous read-only access to data, while only one thread can have write access at any given time and no other readers or writers are allowed.
Another method to initialize read-write lock objects is to statically initialize them through the Fortran constant PTHREAD_RWLOCK_INITIALIZER. If this method of initialization is used, it is not necessary to call this function before using the read-write lock objects.
Function
INTEGER(4)
This function returns 0.
This function applies a read lock to the read-write lock specified by the argument rwlock. The calling thread acquires the read lock if a writer does not hold the lock and there are no writes blocked on the lock. Otherwise, the calling thread will not acquire the read lock. If the read lock is not acquired, the calling thread blocks (that is, it does not return from the f_pthread_rwlock_rdlock call) until it can acquire the lock. Results are undefined if the calling thread holds a write lock on rwlock at the time the call is made. A thread may hold multiple concurrent read locks on rwlock (that is, successfully call the f_pthread_rwlock_rdlock function n times). If so, the thread must perform matching unlocks (that is, it must call the f_pthread_rwlock_unlock function n times).
Function
INTEGER(4)
On successful completion, this function returns 0. Otherwise, this function returns one of the following errors.
A derived data type whose components are all private. Any object of this type should be manipulated only through the appropriate interfaces provided in this module. In addition, objects of this type can be initialized statically through the Fortran constant PTHREAD_RWLOCK_INITIALIZER.
Data Type
This function applies a read lock like the f_pthread_rwlock_rdlock function with the exception that the function fails if any thread holds a write lock on rwlock or there are writers blocked on rwlock. In that case, the function returns EBUSY. The calling thread can check the return code to take further actions.
Function
INTEGER(4)
This function returns zero if the lock for reading on the read-write lock object specified by rwlock is acquired. Otherwise, the following error will be returned:
This function applies a write lock like the f_pthread_rwlock_wrlock function with the exception that the function fails if any thread currently holds rwlock (for reading or writing). In that case, the function returns EBUSY. The calling thread can check the return code to take further actions.
Function
INTEGER(4)
This function returns zero if the lock for writing on the read-write lock object specified by rwlock is acquired. Otherwise, the following error will be returned:
This function is used to release a lock held on the read-write lock object specified by the argument rwlock. If this function is called to release a read lock from the read-write lock object and there are other read locks currently held on this read-write lock object, the read-write lock object remains in the read locked state. If this function releases the calling thread's last read lock on this read-write lock object, then the calling thread is no longer one of the owners of the object. If this function releases the last read lock for this read-write lock object, the read-write lock object will be put in the unlocked state with no owners.
Function
INTEGER(4)
On successful completion, this function returns 0. Otherwise, this function returns one of the following errors.
This function applies a write lock to the read-write lock specified by the argument rwlock. The calling thread acquires the write lock if no other thread (reader or writer) holds the read-write lock rwlock. Otherwise, the thread blocks (that is, does not return from the f_pthread_rwlock_wrlock call) until it acquires the lock. Results are undefined if the calling thread holds the read-write lock (whether a read or write lock) at the time the call is made.
Function
INTEGER(4)
On successful completion, this function returns 0. Otherwise, this function returns the following error.
This function destroys a read-write lock attributes object specified by the argument rwattr which has been initialized previously. A read-write lock created with this attribute will not be affected by the action.
Function
INTEGER(4)
On successful completion, this function returns 0. Otherwise, this function returns the following error.
This function is used to obtain the value of the process-shared attribute from the initialized read-write lock attributes object specified by the argument rwattr. The current setting of this attribute will be returned in the argument pshared. pshared will contain one of the following values:
Function
On return from this function, the value of pshared will be one of the following:
INTEGER(4)
If this function completes successfully, value 0 is returned and the value of the process-shared attribute of rwattr is stored into the object specified by the argument pshared. Otherwise, the following error will be returned:
This function initializes a read-write lock attributes object specified by rwattr with the default value for all of the attributes.
Function
INTEGER(4)
On successful completion, this function returns 0. Otherwise, this function returns the following error.
This function is used to set the process-shared attribute in an initialized read-write lock attributes object specified by the argument rwattr.
Function
Must be one of the following:
INTEGER(4)
On successful completion, this function returns 0. Otherwise, this function returns one of the following errors.
This is a derived data type whose components are all private. Any object of this type should be manipulated only through the appropriate interfaces provided in this module.
Data Type
Function
None
TYPE(f_pthread_t)
The calling thread's ID is returned.
This function can be used to set the thread's cancelability state. The new state will be set according to the argument state. The old state will be returned in the argument oldstate.
Function
Must contain one of the following:
On return from this function, oldstate will contain one of the following values:
INTEGER(4)
On successful completion, this function returns 0. Otherwise, this function returns the following error.
This function can be used to set the thread's cancelability type. The new type will be set according to the argument type. The old type will be returned in argument oldtype.
Function
Must contain one of the following values:
On return from this procedure, oldtype will contain one of the following values:
INTEGER(4)
On successful completion, this function returns 0. Otherwise, this function returns the following error.
This function is used to inform the pthreads library implementation of desired concurrency level as specified by the argument new_level. The actual level of concurrency provided by the implementation as a result of this function call is unspecified.
Function
INTEGER(4)
This function returns 0.
This function can be used to dynamically set the scheduling policy and the scheduling property of a thread. The target thread is identified by argument thread. The new scheduling policy for the target thread is provided through argument policy. The new scheduling property of the target thread will be set to the value provided by argument param. The sched_priority field in param defines the scheduling priority. Its range is 1-127.
Function
INTEGER(4)
On successful completion, this function returns 0. Otherwise, this function returns one of the following errors
This function can be used to set the calling thread's specific data associated with the key identified by argument key. The argument arg, which is optional, identifies the thread-specific data to be set. If arg is not provided, the thread-specific data will be set to NULL, which is the initial value for each thread. Only an Integer pointer can be passed as the arg argument. If arg is not an Integer pointer, the result is undefined.
The actual argument arg must be a variable, and consequently eligible as a left-value in an assignment statement. If you pass an array section with vector subscripts to the argument arg, the result is unpredictable.
Function
INTEGER(4)
On successful completion, this function returns 0. Otherwise, this function returns one of the following errors
A derived data type whose components are all private. Any object of this type should be manipulated only through the appropriate interfaces provided in this module.
This data type corresponds to the POSIX pthread_t, which is the type of thread object.
Data Type
This subroutine provides a cancelation point in a thread. When it is called, any pending cancelation request will be acted upon immediately if it is in the enabled state.
Subroutine
None
None
This data type corresponds to the Linux system data structure sched_param, which is a system data type.
This is a public data structure defined as:
type f_sched_param sequence integer sched_priority end type f_sched_param
Data Type
This function is used to force the calling thread to relinquish the processor until it again becomes the head of its thread list.
Function
None.
INTEGER(4)
If this function completes successfully, value 0 is returned. Otherwise, a value of -1 will be returned.
This is a Fortran definition of the Linux system data structure timespec. Within the Fortran Pthreads module, objects of this type are used to specify an absolute date and time. This deadline absolute date is used when waiting on a POSIX condition variable.
In 32-bit mode, f_timespec is defined as:
TYPE F_Timespec SEQUENCE INTEGER(4) tv_sec INTEGER(KIND=REGISTER_SIZE) tv_nsec END TYPE F_Timespec
In 64-bit mode, f_timespec is defined as:
TYPE F_Timespec SEQUENCE INTEGER(4) tv_sec INTEGER(4) pad INTEGER(KIND=REGISTER_SIZE) tv_nsec END TYPE F_Timespec
Data Type