par...

Top  Previous  Next

par_fprintf

#include <par.h>

int par_fprintf (

   FILE       *stream,

   const char *format,

   ...

);

server

par_fprintf provides access to the function fprintf in circumstances where multiple threads are active; access to the standard I/O structures in the run-time library is interlocked through the semaphore par_sema. In other respects, par_fprintf behaves like fprintf, with the same arguments.

 

It returns the number of characters output, or a negative value if an output error has occurred.

 

Dragons003Do not call this function if the current thread has already claimed par_sema by calling sema_wait. This could cause the thread to hang indefinitely.

par_free

#include <par.h>

void par_free (

   void *ap

);

stand-alone

This function is now identical to free. par_free is retained only for backwards compatibility; you should avoid using it.

par_malloc

#include <par.h>

void *par_malloc (

   size_t nwords

);

stand-alone

This function is now identical to malloc.  par_malloc is retained only for backwards compatibility; you should avoid using it.

par_printf

#include <par.h>

int par_printf (

   const char *format,

   ...

);

server

par_printf provides access to the function printf in circumstances where multiple threads are active; access to the standard I/O structures in the run-time library is interlocked through the semaphore par_sema. In other respects, par_printf behaves like printf, with the same arguments. It returns the number of characters output, or a negative value if an output error has occurred.

 

Dragons003Do not call this function if the current thread has already claimed par_sema by calling sema_wait. This could cause the thread to hang indefinitely.

par_sema

#include <par.h>

SEMA par_sema;

stand-alone

When a task has more than one thread is running, steps must be taken to ensure that only one thread at a time makes use of certain run-time library functions. A thread can ensure that this rule is not broken by waiting for the semaphore par_sema before using one of these functions.

 

After finishing with the run-time library, the thread should signal par_sema so that other threads can get access.

 

par_sema is also used by all the functions of the par package. For this reason, you must not call one of the other par package functions from a thread which has already claimed par_sema as described above.

 

Dragons003Note that par_sema is initialized automatically by the run-time library. Do not try to initialize it in your own code.