2004 by Marc J. Rochkind. All rights reserved. Portions marked "Open Source" may be copied under license.

 

Main Page   Modules   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

c5/t2-mtx.c File Reference


Detailed Description

Thread example (background sorting; with mutexes) [Sec. 5.17 (not in book)].

Definition in file t2-mtx.c.

Go to the source code of this file.

Compounds

struct  dict

Defines

#define MAX_ENTRIES   100

Functions

int compar (const void *x, const void *y)
void * sorter (void *arg)
int main (void)

Variables

pthread_mutex_t mtx = PTHREAD_MUTEX_INITIALIZER


Define Documentation

#define MAX_ENTRIES   100
 

Definition at line 24 of file t2-mtx.c.

Referenced by main().


Function Documentation

int compar const void *  x,
const void *  y
[static]
 

Definition at line 34 of file t2-mtx.c.

Referenced by sorter().

int main void   ) 
 

Definition at line 58 of file t2-mtx.c.

References dict::d_entry, dict::d_issorted, dict::d_nentries, EC_CLEANUP_BGN, EC_CLEANUP_END, EC_FAIL, ec_null, ec_rv, errno, MAX_ENTRIES, mtx, pthread_create(), pthread_mutex_lock(), pthread_mutex_unlock(), and sorter().

void* sorter void *  arg  )  [static]
 

Definition at line 39 of file t2-mtx.c.

References compar(), dict::d_entry, dict::d_issorted, dict::d_nentries, EC_CLEANUP_BGN, EC_CLEANUP_END, ec_rv, exit(), mtx, pthread_mutex_lock(), pthread_mutex_unlock(), and sleep().

Referenced by main().


Variable Documentation

pthread_mutex_t mtx = PTHREAD_MUTEX_INITIALIZER [static]
 

Definition at line 32 of file t2-mtx.c.

Referenced by main(), and sorter().


Generated on Fri Apr 23 10:57:08 2004 for AUP2 Example Source by doxygen 1.3.1