Cross reference for modules/th/thread.c of index.

# File modules/th/thread.c

      $Revision: 1.22 $

      Example code: A thread.

      Status: NOT REVUED, NOT TESTED

     Authors:       Chris Ottrey
    		Joao Damas

    Online References:

## Included Files

- `#include <pthread.h>`

- `#include <stdio.h>`

- `#include <strings.h>`

- `#include "modules/th/thread.h"`
  - `#include <pthread.h>`

- `#include "include/memwrap.h"`
  - `#include <include/erroutines.h>`
  - `#include <glib.h>`

## Preprocessor definitions

String sizes

`#define STR_S 63`

`#define STR_M 255`

`#define STR_L 1023`

`#define STR_XL 4095`

`#define STR_XXL 16383`

## Global Function TH_acquire_read_lock()

      Aquire a readers lock.

      Reference: "Multithreaded Programming Techniques - Prasad p.192"
      More:

      Author:
            ottrey

`void TH_acquire_read_lock ( rw_lock_t* prw_lock )`

`rw_lock_t* prw_lock`
  Readers writers lock.

Prototyped in: | modules/th/thread.h
Calls: | pthread_cond_wait(), pthread_mutex_lock(), pthread_mutex_unlock()
Called by: | AC_check_acl() | modules/ac/access_control.c
| AC_fetch_acc() | modules/ac/access_control.c
| RP_asc_search() | modules/rp/rp_search.c
| RP_new_asc_search() | modules/rp/rp_search.c

## Global Function TH_acquire_write_lock()

      Aquire a writers lock.

      Reference: "Multithreaded Programming Techniques - Prasad p.192"
      More:

      Author:
            ottrey

`void TH_acquire_write_lock ( rw_lock_t* prw_lock )`

`rw_lock_t* prw_lock`
  Readers writers lock.

Prototyped in: | modules/th/thread.h
Calls: | pthread_cond_wait(), pthread_mutex_lock(), pthread_mutex_unlock()
Called by: | AC_acc_load() | modules/ac/access_control.c
| AC_ban_set() | modules/ac/access_control.c
| AC_commit_credit() | modules/ac/access_control.c
| AC_decay() | modules/ac/access_control.c
| RP_tree_add() | modules/rp/rp_tree.c
| RP_uni_node() | modules/rp/rp_update.c

## Global Function TH_create()

      This is the routine that creates a thread.

       More:

      Author:
            ottrey
    	joao
    	andrei

`pthread_t TH_create ( void* do_function(void*), void* arguments )`

Prototyped in: | modules/th/thread.h
Calls: | pthread_attr_init(), pthread_attr_setdetachstate(), pthread_create()
Called by: | SV_concurrent_server() | modules/sv/server.c
| SV_start() | modules/sv/server.c
| SV_watchdog() | modules/sv/server.c
| main_loop() | modules/sv/server.c

## Global Function TH_get_id()

`int TH_get_id ( void )`

Prototyped in: | modules/th/thread.h
Calls: | pthread_self()
Called by: | log_config() | modules/pc/protocol_config.c

## Global Function TH_init_read_write_lock()

      Initialize a readers/writers lock.

      Side effect: the lock is set to open(?)

      Reference: "Multithreaded Programming Techniques - Prasad p.192"
      More:

      Author:
            ottrey

`void TH_init_read_write_lock ( rw_lock_t* prw_lock )`

`rw_lock_t* prw_lock`
  Readers writers lock.

Prototyped in: | modules/th/thread.h
Calls: | pthread_cond_init(), pthread_mutex_init()
Called by: | RX_tree_cre() | modules/rx/rx_tree.c

## Global Function TH_release_read_lock()

      Release a readers lock.

      Reference: "Multithreaded Programming Techniques - Prasad p.192"
      More:

      Author:
            ottrey

`void TH_release_read_lock ( rw_lock_t* prw_lock )`

`rw_lock_t* prw_lock`
  Readers writers lock.

Prototyped in: | modules/th/thread.h
Calls: | pthread_cond_signal(), pthread_mutex_lock(), pthread_mutex_unlock()
Called by: | AC_check_acl() | modules/ac/access_control.c
| AC_fetch_acc() | modules/ac/access_control.c
| RP_asc_search() | modules/rp/rp_search.c
| RP_new_asc_search() | modules/rp/rp_search.c

## Global Function TH_release_write_lock()

      Release a writers lock.

      Reference: "Multithreaded Programming Techniques - Prasad p.192"
      More:

      Author:
            ottrey

`void TH_release_write_lock ( rw_lock_t* prw_lock )`

`rw_lock_t* prw_lock`
  Readers writers lock.

Prototyped in: | modules/th/thread.h
Calls: | pthread_cond_broadcast(), pthread_mutex_lock(), pthread_mutex_unlock()
Called by: | AC_acc_load() | modules/ac/access_control.c
| AC_ban_set() | modules/ac/access_control.c
| AC_commit_credit() | modules/ac/access_control.c
| AC_decay() | modules/ac/access_control.c
| RP_sql_load_attr_space() | modules/rp/rp_load.c
| RP_uni_node() | modules/rp/rp_update.c

## Global Function TH_to_string()

`char* TH_to_string ( void )`

Prototyped in: | modules/th/thread.h
Calls: | fprintf(), pthread_self(), sprintf(), strcat(), strcpy(), strlen(), wr_real_malloc()