Changeset 635 for trunk/kernel/libk/remote_condvar.c
- Timestamp:
- Jun 26, 2019, 11:42:37 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kernel/libk/remote_condvar.c
r581 r635 2 2 * remote_condvar.c - remote kernel condition variable implementation. 3 3 * 4 * Authors Alain Greiner (2016,2017,2018 )4 * Authors Alain Greiner (2016,2017,2018,2019) 5 5 * 6 6 * Copyright (c) UPMC Sorbonne Universites … … 86 86 { 87 87 remote_condvar_t * condvar_ptr; 88 xptr_t condvar_xp;88 kmem_req_t req; 89 89 90 90 // get pointer on local process descriptor … … 98 98 process_t * ref_ptr = (process_t *)GET_PTR( ref_xp ); 99 99 100 // allocate memory for new condvar in reference cluster 101 if( ref_cxy == local_cxy ) // local cluster is the reference 102 { 103 kmem_req_t req; 104 req.type = KMEM_CONDVAR; 105 req.flags = AF_ZERO; 106 condvar_ptr = kmem_alloc( &req ); 107 condvar_xp = XPTR( local_cxy , condvar_ptr ); 108 } 109 else // reference cluster is remote 110 { 111 rpc_kcm_alloc_client( ref_cxy , KMEM_CONDVAR , &condvar_xp ); 112 condvar_ptr = GET_PTR( condvar_xp ); 113 } 114 115 if( condvar_xp == XPTR_NULL ) return 0xFFFFFFFF; 100 req.type = KMEM_KCM; 101 req.order = bits_log2( sizeof(remote_condvar_t) ); 102 req.flags = AF_ZERO | AF_KERNEL; 103 condvar_ptr = kmem_alloc( &req ); 104 105 if( condvar_ptr == NULL ) 106 { 107 printk("\n[ERROR] in %s : cannot create condvar\n", __FUNCTION__ ); 108 return -1; 109 } 116 110 117 111 // initialise condvar … … 136 130 void remote_condvar_destroy( xptr_t condvar_xp ) 137 131 { 132 kmem_req_t req; 133 138 134 // get pointer on local process descriptor 139 135 process_t * process = CURRENT_THREAD->process; … … 166 162 167 163 // release memory allocated for condvar descriptor 168 if( condvar_cxy == local_cxy ) // reference is local 169 { 170 kmem_req_t req; 171 req.type = KMEM_SEM; 172 req.ptr = condvar_ptr; 173 kmem_free( &req ); 174 } 175 else // reference is remote 176 { 177 rpc_kcm_free_client( condvar_cxy , condvar_ptr , KMEM_CONDVAR ); 178 } 164 req.type = KMEM_KCM; 165 req.ptr = condvar_ptr; 166 kmem_remote_free( ref_cxy , &req ); 179 167 180 168 } // end remote_convar_destroy()
Note: See TracChangeset
for help on using the changeset viewer.