irods  4.2.8
About: iRODS (the integrated Rule Oriented Data System) is a distributed data-management system for creating data grids, digital libraries, persistent archives, and real-time data systems.
  Fossies Dox: irods-4.2.8.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

irods_threads.cpp
Go to the documentation of this file.
1 #include "irods_threads.hpp"
2 
3 
4 // =-=-=-=-=-=-=-
5 //
7  thread_context* _ctx ) {
8  if ( !_ct ) {
9  return;
10  }
11 #ifdef __cplusplus
12 #else // __cplusplus
13 #endif // __cplusplus
14 }
15 
16 // =-=-=-=-=-=-=-
17 //
19  thread_context* _ctx ) {
20  if ( !_ct ) {
21  return;
22  }
23 #ifdef __cplusplus
24 #else // __cplusplus
25 #endif // __cplusplus
26 }
27 
28 // =-=-=-=-=-=-=-
29 //
31  thread_context* _ctx ) {
32  if ( !_ct ) {
33  return;
34  }
35 #ifdef __cplusplus
36  _ctx->lock.;
37  ock();
38 #else // __cplusplus
39 #endif // __cplusplus
40 }
41 
42 // =-=-=-=-=-=-=-
43 //
45  thread_context* _ctx ) {
46  if ( !_ct ) {
47  return;
48  }
49 #ifdef __cplusplus
50  _ctx->lock.unlock();
51 #else // __cplusplus
52 #endif // __cplusplus
53 }
54 
55 // =-=-=-=-=-=-=-
56 //
58  thread_context* _ctx,
59  thread_proc_t _proc,
60  void* _data ) {
61  int result = 0;
62  _ctx->exit_flg = false;
63 #ifdef __cplusplus
64  _ctx->lock = new boost::mutex;
65  _ctx->cond = new boost::condition_variable;
66  _ctx->reconnThr = new boost::thread( _proc, _data );
67 #else // __cplusplus
68  pthread_mutex_init( &_ctx->lock, NULL );
69  pthread_cond_init( &_ctx->cond, NULL );
70  result = pthread_create(
71  &_ctx->reconnThr,
73  _proc, //(void *(*)(void *)) cliReconnManager,
74  _data ); //(void *) conn);
75 #endif // __cplusplus
76  return result;
77 }
78 
79 // =-=-=-=-=-=-=-
80 //
82  thread_context* _ctx ) {
83  if ( !_ctx ) {
84  return;
85  }
86 #ifdef __cplusplus
87  delete conn->reconnThr;
88  delete conn->lock;
89  delete conn->cond;
90 #else // __cplusplus
91  pthread_cancel( conn->reconnThr );
92  pthread_detach( conn->reconnThr );
93  pthread_mutex_destroy( &conn->lock );
94  pthread_cond_destroy( &conn->cond );
95 #endif // __cplusplus
96 }
97 
98 // =-=-=-=-=-=-=-
99 //
101  thread_context* _ctx ) {
102  if ( !_ct ) {
103  return;
104  }
105  _ctx->exit_flg = true; // signal an exit
106 #ifdef __cplusplus
107  boost::system_time until = boost::get_system_time() + boost::posix_time::seconds( 2 );
108  _ctx->reconnThr->timed_join( until ); // force an interruption point
109 #else // __cplusplus
110  _ctx->reconnThr->interrupt();
111 #endif // __cplusplus
112 }
113 
114 
115 
116 
NULL
#define NULL
Definition: rodsDef.h:70
thread_free
void thread_free(thread_context *_ctx)
Definition: irods_threads.cpp:81
thread_context::cond
boost::condition_variable * cond
Definition: irods_threads.hpp:13
thread_context::reconnThr
boost::thread * reconnThr
Definition: irods_threads.hpp:11
thread_notify
void thread_notify(thread_context *_ctx)
Definition: irods_threads.cpp:18
irods_threads.hpp
pthread_attr_default
#define pthread_attr_default
Definition: dataObjInpOut.h:26
thread_interrupt
void thread_interrupt(thread_context *_ctx)
Definition: irods_threads.cpp:100
thread_lock
void thread_lock(thread_context *_ctx)
Definition: irods_threads.cpp:30
thread_wait
void thread_wait(thread_context *_ctx)
Definition: irods_threads.cpp:6
thread_alloc
int thread_alloc(thread_context *_ctx, thread_proc_t _proc, void *_data)
Definition: irods_threads.cpp:57
thread_context
Definition: irods_threads.hpp:10
thread_context::lock
boost::mutex * lock
Definition: irods_threads.hpp:12
thread_unlock
void thread_unlock(thread_context *_ctx)
Definition: irods_threads.cpp:44