Changeset 46eec3b in mainline
- Timestamp:
- 2011-01-25T22:15:36Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 8526e585
- Parents:
- c80fdd0
- Location:
- uspace/lib/c
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/async.c
rc80fdd0 r46eec3b 168 168 /** Identifier of the incoming connection handled by the current fibril. */ 169 169 fibril_local connection_t *FIBRIL_connection; 170 171 static void *default_client_data_constructor(void) 172 { 173 return NULL; 174 } 175 176 static void default_client_data_destructor(void *data) 177 { 178 } 179 180 static async_client_data_ctor_t async_client_data_create = 181 default_client_data_constructor; 182 static async_client_data_dtor_t async_client_data_destroy = 183 default_client_data_destructor; 184 185 void async_set_client_data_constructor(async_client_data_ctor_t ctor) 186 { 187 async_client_data_create = ctor; 188 } 189 190 void async_set_client_data_destructor(async_client_data_dtor_t dtor) 191 { 192 async_client_data_destroy = dtor; 193 } 170 194 171 195 static void default_client_connection(ipc_callid_t callid, ipc_call_t *call); … … 517 541 client_t *cl; 518 542 link_t *lnk; 543 void *unref_client_data = NULL; 519 544 520 545 /* … … 542 567 } 543 568 cl->in_task_hash = FIBRIL_connection->in_task_hash; 544 cl->data = NULL; 569 async_serialize_start(); 570 cl->data = async_client_data_create(); 571 async_serialize_end(); 545 572 cl->refcnt = 1; 546 573 hash_table_insert(&client_hash_table, &key, &cl->link); … … 560 587 if (--cl->refcnt == 0) { 561 588 hash_table_remove(&client_hash_table, &key, 1); 589 unref_client_data = cl->data; 562 590 free(cl); 563 591 } 564 592 futex_up(&async_futex); 593 594 if (unref_client_data) 595 async_client_data_destroy(unref_client_data); 565 596 566 597 /* -
uspace/lib/c/include/async.h
rc80fdd0 r46eec3b 44 44 45 45 typedef ipc_callid_t aid_t; 46 47 typedef void *(*async_client_data_ctor_t)(void); 48 typedef void (*async_client_data_dtor_t)(void *); 49 46 50 typedef void (*async_client_conn_t)(ipc_callid_t, ipc_call_t *); 47 51 … … 97 101 extern void async_create_manager(void); 98 102 extern void async_destroy_manager(void); 103 104 extern void async_set_client_data_constructor(async_client_data_ctor_t); 105 extern void async_set_client_data_destructor(async_client_data_dtor_t); 99 106 100 107 extern void async_set_client_connection(async_client_conn_t);
Note:
See TracChangeset
for help on using the changeset viewer.