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/tx7.c File Reference

Detailed Description

Thread example (cleanup handler) [Sec. 5.17.5].

Definition in file tx7.c.

Go to the source code of this file.


struct  node


void cleanup_handler (void *arg)
void * thread_func (void *arg)
int main (void)


pthread_mutex_t mtx = PTHREAD_MUTEX_INITIALIZER
pthread_cond_t cond = PTHREAD_COND_INITIALIZER
node * head

Function Documentation

void cleanup_handler void *  arg  )  [static]

Definition at line 33 of file tx7.c.

References mtx, and pthread_mutex_unlock().

Referenced by thread_func().

int main void   ) 

Definition at line 65 of file tx7.c.

References cond, EC_CLEANUP_BGN, EC_CLEANUP_END, ec_null, ec_rv, head, mtx, node::n_next, node::n_number, pthread_cancel(), pthread_cond_signal(), pthread_create(), pthread_join(), pthread_mutex_lock(), pthread_mutex_unlock(), sleep(), and thread_func().

void* thread_func void *  arg  )  [static]

Definition at line 39 of file tx7.c.

References cleanup_handler(), cond, EC_CLEANUP_BGN, EC_CLEANUP_END, EC_FLUSH, ec_rv, head, mtx, node::n_next, node::n_number, pthread_cleanup_pop(), pthread_cleanup_push(), pthread_cond_wait(), pthread_mutex_lock(), and pthread_mutex_unlock().

Referenced by main().

Variable Documentation

pthread_cond_t cond = PTHREAD_COND_INITIALIZER [static]

Definition at line 25 of file tx7.c.

Referenced by main(), and thread_func().

struct node * head

pthread_mutex_t mtx = PTHREAD_MUTEX_INITIALIZER [static]

Definition at line 24 of file tx7.c.

Referenced by cleanup_handler(), main(), and thread_func().

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