Go to the documentation of this file.
20 #define ERR_NOT_READY 0
21 #define ERR_TIMED_OUT 1
22 #define INFINITE_TIME 0
24 static struct timeval starttime;
29 static void sys_sem_free_internal(
struct sys_sem *sem);
80 sys_sem_free_internal(*sem);
113 time_needed = cond_wait(&(sem->
cond), &(sem->
mutex), timeout);
123 cond_wait(&(sem->
cond), &(sem->
mutex), 0);
234 if (mbox->tail == mbox->head) {
259 (
void *)mbox, (
void *)msg));
268 if (mbox->tail == mbox->head) {
390 new_thread->
next = threads;
393 threads = new_thread;
404 kpanic(
"sys_thread_new: ubthread_create");
413 void (*
function)(
void*);
419 unsigned long sec, usec;
430 usec += timeout % 1000 * 1000;
431 sec += (int) (timeout / 1000) + (int) (usec / 1000000);
432 usec = usec % 1000000;
456 static struct sys_thread* current_thread(
void) {
461 for (st = threads; st !=
NULL; st = st->
next) {
468 kprintf(
"sys: current_thread: could not find current thread!\n");
469 kprintf(
"This is due to a race condition in the LinuxThreads\n");
470 kprintf(
"ubthreads implementation. Start the program again.\n");
478 thread = current_thread();
479 return (&
thread->timeouts);
492 msec = sec * 1000 + usec / 1000;
503 struct file *nfp = 0x0;
514 if (nfp->
fd == 0x0 && nfp->
socket) {
516 kprintf(
"[%s:%i] fdestroy() failed.", __FILE__, __LINE__);
int sys_setsockopt(struct thread *td, struct sys_setsockopt_args *args)
void sys_sem_set_invalid(struct sys_sem **s)
void sys_mbox_free(struct sys_mbox **mb)
#define LWIP_ASSERT(message, assertion)
struct sys_timeout * next
err_t sys_sem_new(sys_sem_t **sem, uint8_t count)
uint32_t sys_arch_mbox_tryfetch(struct sys_mbox **mb, void **msg)
int ubthread_cond_wait(ubthread_cond_t *cond, ubthread_mutex_t *mutex)
void sys_sem_free(struct sys_sem **sem)
struct taskStruct * ubthread_self()
int sys_sem_valid(struct sys_sem **s)
uint32_t sys_arch_sem_wait(struct sys_sem **s, uint32_t timeout)
void kfree(void *baseAddr)
int sem_destroy(sys_sem_t **)
struct sys_thread * thread
void spinUnlock(spinLock_t *lock)
sys_thread_t sys_thread_new(const char *name, void(*thread)(void *arg), void *arg, int stacksize, int prio)
void sys_mbox_post(struct sys_mbox **mb, void *msg)
int fdestroy(struct thread *td, struct file *fp, int fd)
This destroys a thread local file descriptor.
#define SPIN_LOCK_INITIALIZER
void sys_mutex_free(sys_mutex_t *mutex)
int falloc(struct thread *, struct file **, int *)
void kpanic(const char *fmt,...)
print panic message and halt system
void sys_mutex_lock(sys_mutex_t *mutex)
int ubthread_mutex_init(ubthread_mutex_t *mutex, const uInt32 attr)
int sem_init(sys_sem_t **, uint8_t)
void spinLock(spinLock_t *lock)
int gettimeofday(struct timeval *tp, struct timezone *tzp)
void sys_sem_signal(struct sys_sem **s)
int ubthread_mutex_unlock(ubthread_mutex_t *mutex)
int ubthread_mutex_lock(ubthread_mutex_t *mutex)
int sys_sendto(struct thread *td, struct sys_sendto_args *args)
struct ubthread_mutex_list * mutex
struct sys_timeouts timeouts
int ubthread_cond_timedwait(ubthread_cond_t *cond, ubthread_mutex_t *mutex, const struct timespec *abstime)
int getfd(struct thread *td, struct file **fp, int fd)
get pointer to file fd in specified thread
#define LWIP_UNUSED_ARG(x)
int sys_mbox_valid(struct sys_mbox **mb)
err_t sys_mutex_new(sys_mutex_t *mutex)
struct sys_timeouts * sys_arch_timeouts(void)
uint32_t sys_arch_mbox_fetch(struct sys_mbox **mb, void **msg, uint32_t timeout)
void sys_mbox_set_invalid(struct sys_mbox **mb)
void sys_mutex_unlock(sys_mutex_t *mutex)
int ubthread_cond_broadcast(ubthread_cond_t *cond)
int ubthread_mutex_destroy(ubthread_mutex_t *mutex)
void * kmalloc(uInt32 len)
int ubthread_cond_init(ubthread_cond_t *cond, const uInt32 attr)
void * memset(void *dst, int c, size_t length)
unsigned long sys_unix_now()
int sys_socket(struct thread *td, struct sys_socket_args *args)
err_t sys_mbox_new(struct sys_mbox **mb, int size)
int kprintf(const char *,...)
err_t sys_mbox_trypost(struct sys_mbox **mb, void *msg)
#define LWIP_DEBUGF(debug, message)
int ubthread_create(struct taskStruct **thread, const uInt32 *attr, void(*tproc)(void), void *arg)