Subversion Repositories HelenOS-historic

Compare Revisions

Ignore whitespace Rev 1719 → Rev 1718

/uspace/trunk/libc/generic/async.c
26,7 → 26,7
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
 
/** @addtogroup libc
/** @addtogroup libc
* @{
*/
/** @file
373,13 → 373,11
/* Setup thread local connection pointer */
PS_connection = (connection_t *)arg;
PS_connection->cthread(PS_connection->callid, &PS_connection->call);
/* Remove myself from connection hash table */
futex_down(&async_futex);
key = PS_connection->in_phone_hash;
hash_table_remove(&conn_hash_table, &key, 1);
futex_up(&async_futex);
/* Answer all remaining messages with ehangup */
while (!list_empty(&PS_connection->msg_queue)) {
msg = list_get_instance(PS_connection->msg_queue.next, msg_t, link);
391,8 → 389,6
}
if (PS_connection->close_callid)
ipc_answer_fast(PS_connection->close_callid, 0, 0, 0);
return 0;
}
 
/** Create new thread for a new connection
409,8 → 405,11
* opening the connection
* @return New thread id
*/
pstid_t async_new_connection(ipcarg_t in_phone_hash,ipc_callid_t callid, ipc_call_t *call, void (*cthread)(ipc_callid_t, ipc_call_t *))
pstid_t async_new_connection(ipcarg_t in_phone_hash,ipc_callid_t callid,
ipc_call_t *call,
void (*cthread)(ipc_callid_t,ipc_call_t *))
{
pstid_t ptid;
connection_t *conn;
unsigned long key;
 
515,10 → 514,9
 
while (1) {
if (psthread_schedule_next_adv(PS_FROM_MANAGER)) {
futex_up(&async_futex);
/* async_futex is always held
* when entering manager thread
*/
futex_up(&async_futex); /* async_futex is always held
* when entering manager thread
*/
continue;
}
futex_down(&async_futex);
548,8 → 546,6
 
handle_call(callid, &call);
}
return 0;
}
 
/** Function to start async_manager as a standalone thread
561,12 → 557,9
*/
static int async_manager_thread(void *arg)
{
futex_up(&async_futex);
/* async_futex is always locked when entering
* manager */
futex_up(&async_futex); /* async_futex is always locked when entering
* manager */
async_manager_worker();
return 0;
}
 
/** Add one manager to manager list */
592,7 → 585,6
return ENOMEM;
}
return 0;
}
 
/** IPC handler for messages in async framework
687,6 → 679,7
void async_wait_for(aid_t amsgid, ipcarg_t *retval)
{
amsg_t *msg = (amsg_t *) amsgid;
connection_t *conn;
 
futex_down(&async_futex);
if (msg->done) {
718,6 → 711,7
int async_wait_timeout(aid_t amsgid, ipcarg_t *retval, suseconds_t timeout)
{
amsg_t *msg = (amsg_t *) amsgid;
connection_t *conn;
 
/* TODO: Let it go through the event read at least once */
if (timeout < 0)
808,5 → 802,7
}
 
 
/** @}
/** @}
*/