sys_arch.c.rej

来自「lwIP-Softools-11Jul2002-alpha」· REJ 代码 · 共 99 行

REJ
99
字号
****************** 30,36 ****   *    * Author: Adam Dunkels <adam@sics.se>   *-  * $Id: sys_arch.c,v 1.1 2001/12/12 10:00:57 adam Exp $   */    #include "lwip/debug.h"--- 30,36 ----   *    * Author: Adam Dunkels <adam@sics.se>   *+  * $Id: sys_arch.c,v 1.3 2002/01/02 17:35:42 adam Exp $   */    #include "lwip/debug.h"****************** 109,124 ****    abort();  }  /*-----------------------------------------------------------------------------------*/  void  sys_thread_new(void (* function)(void *arg), void *arg)  {    struct sys_thread *thread;    thread = malloc(sizeof(struct sys_thread));    thread->next = threads;    thread->timeouts.next = NULL;    threads = thread;  -   if(pthread_create(&(thread->pthread), NULL, (void *(*)(void *))function, arg) != 0) {      perror("sys_thread_new: pthread_create");      abort();    }--- 109,149 ----    abort();  }  /*-----------------------------------------------------------------------------------*/+ struct thread_start_param {+   struct sys_thread *thread;+   void (* function)(void *);+   void *arg;+ };+ + static void *+ thread_start(void *arg)+ {+   struct thread_start_param *tp = arg;+   tp->thread->pthread = pthread_self();+   tp->function(tp->arg);+   free(tp);+   return NULL;+ }+   void  sys_thread_new(void (* function)(void *arg), void *arg)  {    struct sys_thread *thread;+   struct thread_start_param *thread_param;+     thread = malloc(sizeof(struct sys_thread));    thread->next = threads;    thread->timeouts.next = NULL;+   thread->pthread = 0;    threads = thread;  +   thread_param = malloc(sizeof(struct thread_start_param));+   +   thread_param->function = function;+   thread_param->arg = arg;+   thread_param->thread = thread;+ +   if(pthread_create(&(thread->pthread), NULL, thread_start, thread_param) != 0) {      perror("sys_thread_new: pthread_create");      abort();    }****************** 218,226 ****            sys_arch_sem_wait(mbox->mutex, 0);    }-   DEBUGF(SYS_DEBUG, ("sys_mbox_fetch: mbox %p msg %p\n", mbox, *msg));        if(msg != NULL) {      *msg = mbox->msgs[mbox->first];    }    --- 243,251 ----            sys_arch_sem_wait(mbox->mutex, 0);    }        if(msg != NULL) {+     DEBUGF(SYS_DEBUG, ("sys_mbox_fetch: mbox %p msg %p\n", mbox, *msg));      *msg = mbox->msgs[mbox->first];    }    

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?