Add Book to My BookshelfPurchase This Book Online

Appendix A - Pthreads and DCE

Pthreads Programming
Bradford Nichols, Dick Buttlar and Jacqueline Proulx Farrell
 Copyright 1996 O'Reilly & Associates, Inc.

What Does the DCE Programmer Have to Do?
One of the most difficult aspects of using threads under DCE-especially for the novice-is that DCE hides much of what is going on. If you're new to using threads, this may be somewhat confusing. It may appear that several critical steps are missing. For instance, in a DCE server you never need to call a pthread_create routine, specify thread attributes, or detach threads. The rpc_server_listen routine does all of this for you. 
This must delight you experienced threads programmers (who appreciate the value of a free lunch). What do you need to do to complete a multithreaded application that you've designed under DCE? 
Primarily, your job is to ensure that worker thread accesses to shared data are appropriately synchronized. To do so, you'd add the necessary calls to the functions pthread_mutex_lock, pthread_mutex_unlock, pthread_cond_wait,       and pthread_cond_signal in the server management routines (and any submodules or libraries they call). 
Although we've discussed only basic server tasks in this appendix, DCE applications do use threads for other purposes. For instance, you might explicitly call pthread_create to add threads to a DCE server for such tasks as: 
 Renewing security credentials 
  Handling signals 
  Background processing 

Previous SectionNext Section, Inc 2000   Feedback