M_SINGLE(3P)

NAME
m_single, m_multi - mark single-process code section

SYNOPSIS
C syntax:

#include <parallel/microtask.h>
m_single();
(CODE)
m_multi();

Pascal syntax

procedure m_single;
cexternal;
procedure m_multi;
cexternal;

FORTRAN syntax

subroutine m_single
subroutine m_multi

DESCRIPTION
The m_single routine causes child processes to spin at a barrier until the parent process has executed the code following the m_single call and called the m_multi routine. The child processes then resume execution at the source line after the m_multi call. These routines are typically used to allow the parent process to perform I/O or other serial operations during an m_fork call.

NOTES
Calls to m_single are allowed only during m_fork calls. To suspend child processes after an m_fork call, use m_park_procs and m_rele_procs.

Do not call m_multi without calling m_single first.

Nested m_single calls are not allowed. Neither are m_single calls nested between calls to other lock routines, such as s_lock and s_unlock.

RETURN VALUE
Upon successful completion, a value of 0 is returned. Otherwise, a value of -1 is returned and errno is set to indicate the error.

ERRORS
These routines can return the following error:

[EINVAL]
    The routine was called in an inappropriate context. For example, m_fork had never been called, or the processes were already suspended with a call to m_park_procs.

SEE ALSO
m_park_procs(3P), Guide to Parallel Programming