From: <ljs...@us...> - 2012-06-09 04:29:44
|
Revision: 809 http://cadcdev.svn.sourceforge.net/cadcdev/?rev=809&view=rev Author: ljsebald Date: 2012-06-09 04:29:38 +0000 (Sat, 09 Jun 2012) Log Message: ----------- Update kos-ports for the updated condvar stuff. Modified Paths: -------------- kos-ports/lwip/kos/sockets.c kos-ports/lwip/kos/sys_arch.c Modified: kos-ports/lwip/kos/sockets.c =================================================================== --- kos-ports/lwip/kos/sockets.c 2012-06-09 04:18:22 UTC (rev 808) +++ kos-ports/lwip/kos/sockets.c 2012-06-09 04:29:38 UTC (rev 809) @@ -25,9 +25,9 @@ // Sync variables mutex_t mutex; // For the condvars - condvar_t * connect; // A connection was received on a listen() - condvar_t * recv_avail; // Received data is available - condvar_t * send_avail; // Send buffer space is available + condvar_t connect; // A connection was received on a listen() + condvar_t recv_avail; // Received data is available + condvar_t send_avail; // Send buffer space is available // Counters int conncnt; // Number of connections waiting @@ -79,9 +79,9 @@ // Setup some basic stuff mutex_init(&fds[i].mutex, MUTEX_TYPE_NORMAL); - fds[i].connect = cond_create(); - fds[i].recv_avail = cond_create(); - fds[i].send_avail = cond_create(); + cond_init(&fds[i].connect); + cond_init(&fds[i].recv_avail); + cond_init(&fds[i].send_avail); fds[i].connmax = 0; fds[i].conncnt = -1; @@ -99,9 +99,9 @@ } // Destroy all the sync objects - cond_destroy(fds[fd].connect); - cond_destroy(fds[fd].recv_avail); - cond_destroy(fds[fd].send_avail); + cond_destroy(&fds[fd].connect); + cond_destroy(&fds[fd].recv_avail); + cond_destroy(&fds[fd].send_avail); mutex_destroy(&fds[fd].mutex); fds[fd].inuse = 0; @@ -165,8 +165,8 @@ fd->recv = fd->send = -1; // Wake up anyone who was waiting - cond_broadcast(fd->recv_avail); - cond_broadcast(fd->send_avail); + cond_broadcast(&fd->recv_avail); + cond_broadcast(&fd->send_avail); mutex_unlock(&fd->mutex); @@ -200,7 +200,7 @@ // Here would be the place we'd want to implement TCP_NODELAY (or the lack // thereof) but for now we'll just send it all through... - cond_signal(fd->recv_avail); + cond_signal(&fd->recv_avail); // Note that we DON'T ACK the data until after a client has received // it using recv(). Otherwise the peer could send and send and send... @@ -242,7 +242,7 @@ // packet syndrome). rdy = fd->send >= 256; if (rdy) - cond_signal(fd->send_avail); + cond_signal(&fd->send_avail); mutex_unlock(&fd->mutex); @@ -335,7 +335,7 @@ fd->conncnt++; // Signal any thread waiting on accept() - cond_signal(fd->connect); + cond_signal(&fd->connect); out: mutex_unlock(&fd->mutex); @@ -364,7 +364,7 @@ fd->connerr = err; // Signal to proceed - cond_signal(fd->connect); + cond_signal(&fd->connect); mutex_unlock(&fd->mutex); @@ -535,7 +535,7 @@ // Wait for the result fd->connerr = 10; while (fd->connerr > 0) { - cond_wait(fd->connect, &fd->mutex); + cond_wait(&fd->connect, &fd->mutex); } // Convert error codes @@ -738,7 +738,7 @@ // Wait for a connection // printf("lwip_accept(%d): waiting\n", s); - cond_wait(fd->connect, &fd->mutex); + cond_wait(&fd->connect, &fd->mutex); } // Ok, we've got a connection. Find the first available one @@ -806,7 +806,7 @@ // Wait for more data to be available //printf("cond_wait for more data\n"); - cond_wait(fd->recv_avail, &fd->mutex); + cond_wait(&fd->recv_avail, &fd->mutex); //printf("woken\n"); } @@ -886,7 +886,7 @@ rv = 0; goto out; } - cond_wait(fd->send_avail, &fd->mutex); + cond_wait(&fd->send_avail, &fd->mutex); } // Send as much as we can. Modified: kos-ports/lwip/kos/sys_arch.c =================================================================== --- kos-ports/lwip/kos/sys_arch.c 2012-06-09 04:18:22 UTC (rev 808) +++ kos-ports/lwip/kos/sys_arch.c 2012-06-09 04:29:38 UTC (rev 809) @@ -126,10 +126,10 @@ mutex_t mutex; // Signaled whenever mail is available - condvar_t * mail; + condvar_t mail; // Signaled whenever a message is removed - condvar_t * avail; + condvar_t avail; }; @@ -140,8 +140,8 @@ mbox->head = mbox->tail = mbox->cnt = 0; mutex_init(&mbox->mutex, MUTEX_TYPE_NORMAL); - mbox->mail = cond_create(); - mbox->avail = cond_create(); + cond_init(&mbox->mail); + cond_init(&mbox->avail); #ifdef SYS_STATS lwip_stats.sys.mbox.used++; @@ -159,9 +159,8 @@ lwip_stats.sys.mbox.used--; #endif /* SYS_STATS */ mutex_destroy(&mbox->mutex); - cond_destroy(mbox->mail); - cond_destroy(mbox->avail); - mbox->mail = mbox->avail = NULL; + cond_destroy(&mbox->mail); + cond_destroy(&mbox->avail); /* DEBUGF("sys_mbox_free: mbox 0x%lx\n", mbox);*/ free(mbox); } @@ -173,14 +172,14 @@ DEBUGF(SYS_DEBUG, ("sys_mbox_post: mbox %p msg %p\n", mbox, msg)); while (mbox->cnt >= SYS_MBOX_SIZE) { - cond_wait(mbox->avail, &mbox->mutex); + cond_wait(&mbox->avail, &mbox->mutex); } mbox->msgs[mbox->tail] = msg; mbox->cnt++; mbox->tail = (mbox->tail + 1) % SYS_MBOX_SIZE; - cond_signal(mbox->mail); + cond_signal(&mbox->mail); mutex_unlock(&mbox->mutex); } @@ -192,13 +191,13 @@ while (!mbox->cnt) { if (timeout) { - int foo = cond_wait_timed(mbox->mail, &mbox->mutex, timeout); + int foo = cond_wait_timed(&mbox->mail, &mbox->mutex, timeout); if (foo < 0) { time = SYS_ARCH_TIMEOUT; break; } } else - cond_wait(mbox->mail, &mbox->mutex); + cond_wait(&mbox->mail, &mbox->mutex); } if (mbox->cnt) { @@ -209,7 +208,7 @@ mbox->head = (mbox->head + 1) % SYS_MBOX_SIZE; mbox->cnt--; - cond_signal(mbox->avail); + cond_signal(&mbox->avail); } mutex_unlock(&mbox->mutex); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |