Subversion Repositories shark

Compare Revisions

Ignore whitespace Rev 28 → Rev 29

/shark/trunk/kernel/mqueue.c
18,11 → 18,11
 
/**
------------
CVS : $Id: mqueue.c,v 1.1.1.1 2002-03-29 14:12:52 pj Exp $
CVS : $Id: mqueue.c,v 1.2 2002-11-11 08:34:09 pj Exp $
 
File: $File$
Revision: $Revision: 1.1.1.1 $
Last update: $Date: 2002-03-29 14:12:52 $
Revision: $Revision: 1.2 $
Last update: $Date: 2002-11-11 08:34:09 $
------------
 
POSIX message queues
90,8 → 90,8
correct bit is set */
 
/* the blocked processes queues */
QQUEUE blocked_send;
QQUEUE blocked_rcv;
IQUEUE blocked_send;
IQUEUE blocked_rcv;
 
int next; /* the mq queue */
} mq_table[MQ_OPEN_MAX];
105,7 → 105,7
if the task is not blocked...) */
} mqproc_table[MAX_PROC];
 
static QUEUE free_mq; /* Queue of free sem */
static int free_mq; /* Queue of free sem */
 
mqd_t mq_open(const char *name, int oflag, ...)
{
168,8 → 168,8
mq_table[mq].maxmsg = MQ_DEFAULT_MAXMSG;
mq_table[mq].msgsize = MQ_DEFAULT_MSGSIZE;
}
qq_init(&mq_table[mq].blocked_send);
qq_init(&mq_table[mq].blocked_rcv);
iq_init(&mq_table[mq].blocked_send, &freedesc, 0);
iq_init(&mq_table[mq].blocked_rcv, &freedesc, 0);
 
mq_table[mq].count = 0;
mq_table[mq].start = -1;
320,7 → 320,7
/* the task that have to be killed is waiting on a mq_send */
 
/* we have to extract the task from the blocked queue... */
qq_extract(i,&mq_table[mqproc_table[i].mqdes].blocked_send);
iq_extract(i,&mq_table[mqproc_table[i].mqdes].blocked_send);
 
/* and the task have to be reinserted into the ready queues, so it
will fall into task_testcancel */
334,7 → 334,7
/* the task that have to be killed is waiting on a mq_send */
 
/* we have to extract the task from the blocked queue... */
qq_extract(i, &mq_table[mqproc_table[i].mqdes].blocked_rcv);
iq_extract(i, &mq_table[mqproc_table[i].mqdes].blocked_rcv);
 
/* and the task have to be reinserted into the ready queues, so it
will fall into task_testcancel */
357,7 → 357,7
mqproc_table[exec_shadow].intsig = 1;
 
/* we have to extract the task from the blocked queue... */
qq_extract(i, &mq_table[mqproc_table[i].mqdes].blocked_send);
iq_extract(i, &mq_table[mqproc_table[i].mqdes].blocked_send);
 
/* and the task have to be reinserted into the ready queues, so it
will fall into task_testcancel */
373,7 → 373,7
mqproc_table[exec_shadow].intsig = 1;
 
/* we have to extract the task from the blocked queue... */
qq_extract(i, &mq_table[mqproc_table[i].mqdes].blocked_rcv);
iq_extract(i, &mq_table[mqproc_table[i].mqdes].blocked_rcv);
 
/* and the task have to be reinserted into the ready queues, so it
will fall into task_testcancel */
463,7 → 463,7
 
/* we insert the task in the message queue */
proc_table[exec_shadow].status = WAIT_MQSEND;
qq_insert(exec_shadow,&mq_table[mqdes].blocked_send);
iq_priority_insert(exec_shadow,&mq_table[mqdes].blocked_send);
 
/* and finally we reschedule */
exec = exec_shadow = -1;
504,7 → 504,7
/* the mq was empty */
PID p;
 
p = qq_getfirst(&mq_table[mqdes].blocked_rcv);
p = iq_getfirst(&mq_table[mqdes].blocked_rcv);
 
if ( p != NIL) {
/* The first blocked task has to be woken up */
629,7 → 629,7
 
/* we insert the task into the message queue */
proc_table[exec_shadow].status = WAIT_MQRECEIVE;
qq_insert(exec_shadow,&mq_table[mqdes].blocked_rcv);
iq_priority_insert(exec_shadow,&mq_table[mqdes].blocked_rcv);
 
/* and finally we reschedule */
exec = exec_shadow = -1;
671,7 → 671,7
returnvalue = mq_table[mqdes].mq_info[ msg ].msglen;
 
/* if the mq was full, there may be a task into blocked-send queue */
p = qq_getfirst(&mq_table[mqdes].blocked_send);
p = iq_getfirst(&mq_table[mqdes].blocked_send);
 
if ( p != NIL) {
/* The first blocked task on send has to be woken up */