Changeset bc7d44c in mainline for uspace/lib/libc
- Timestamp:
- 2009-08-21T07:33:36Z (16 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- af8e565
- Parents:
- b9c7425 (diff), 207e208e (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - Location:
- uspace/lib/libc
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/libc/generic/async.c
rb9c7425 rbc7d44c 106 106 107 107 atomic_t async_futex = FUTEX_INITIALIZER; 108 109 /** Number of threads waiting for IPC in the kernel. */ 110 atomic_t threads_in_ipc_wait = { 0 }; 108 111 109 112 /** Structures of this type represent a waiting fibril. */ … … 683 686 684 687 futex_up(&async_futex); 688 689 atomic_inc(&threads_in_ipc_wait); 685 690 686 691 ipc_call_t call; … … 688 693 SYNCH_FLAGS_NONE); 689 694 695 atomic_dec(&threads_in_ipc_wait); 696 690 697 if (!callid) { 691 698 handle_expired_timeouts(); -
uspace/lib/libc/generic/fibril_sync.c
rb9c7425 rbc7d44c 40 40 #include <assert.h> 41 41 42 static void optimize_execution_power(void) 43 { 44 /* 45 * When waking up a worker fibril previously blocked in fibril 46 * synchronization, chances are that there is an idle manager fibril 47 * waiting for IPC, that could start executing the awakened worker 48 * fibril right away. We try to detect this and bring the manager 49 * fibril back to fruitful work. 50 */ 51 if (atomic_get(&threads_in_ipc_wait) > 0) 52 ipc_poke(); 53 } 54 42 55 void fibril_mutex_initialize(fibril_mutex_t *fm) 43 56 { … … 84 97 list_remove(&f->link); 85 98 fibril_add_ready((fid_t) f); 99 optimize_execution_power(); 86 100 } 87 101 } … … 152 166 fibril_add_ready((fid_t) f); 153 167 frw->writers++; 168 optimize_execution_power(); 154 169 break; 155 170 } else { … … 157 172 fibril_add_ready((fid_t) f); 158 173 frw->readers++; 174 optimize_execution_power(); 159 175 } 160 176 } … … 200 216 list_remove(&f->link); 201 217 fibril_add_ready((fid_t) f); 218 optimize_execution_power(); 202 219 if (once) 203 220 break; -
uspace/lib/libc/generic/ipc.c
rb9c7425 rbc7d44c 565 565 } 566 566 567 /** Interrupt one thread of this task from waiting for IPC. */ 568 void ipc_poke(void) 569 { 570 __SYSCALL0(SYS_IPC_POKE); 571 } 572 567 573 /** Ask destination to do a callback connection. 568 574 * -
uspace/lib/libc/include/async.h
rb9c7425 rbc7d44c 47 47 extern atomic_t async_futex; 48 48 49 extern atomic_t threads_in_ipc_wait; 50 49 51 extern int __async_init(void); 50 52 extern ipc_callid_t async_get_call_timeout(ipc_call_t *call, suseconds_t usecs); -
uspace/lib/libc/include/ipc/ipc.h
rb9c7425 rbc7d44c 192 192 extern ipc_callid_t ipc_wait_cycle(ipc_call_t *, uint32_t, int); 193 193 extern ipc_callid_t ipc_wait_for_call_timeout(ipc_call_t *, uint32_t); 194 extern void ipc_poke(void); 194 195 195 196 static inline ipc_callid_t ipc_wait_for_call(ipc_call_t *data)
Note:
See TracChangeset
for help on using the changeset viewer.