- Timestamp:
- Aug 8, 2006 11:56:49 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/branches/symbian/pjlib/src/pj/os_core_symbian.cpp
r496 r666 17 17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 18 */ 19 20 #include <e32std.h> 19 21 20 22 #include <pj/os.h> … … 36 38 37 39 40 struct pj_thread_t 41 { 42 char obj_name[PJ_MAX_OBJ_NAME]; 43 RThread thread; 44 pj_thread_proc *proc; 45 void *arg; 46 47 }; 48 38 49 /* 39 50 TODO: implement these stub methods! … … 50 61 } 51 62 63 /* 64 * thread_main() 65 * 66 * This is the main entry for all threads. 67 */ 68 TInt *thread_main(TAny *param) 69 { 70 pj_thread_t *rec = (pj_thread_t *) param; 71 TInt *result; 72 /* pj_status_t rc; */ 73 74 PJ_LOG(6,(rec->obj_name, "Thread started")); 75 76 /* Call user's entry! */ 77 result = (TInt*)(long)(*rec->proc)(rec->arg); 78 79 /* Done. */ 80 PJ_LOG(6,(rec->obj_name, "Thread quitting")); 81 82 return result; 83 } 84 85 /* 86 * pj_thread_create(...) 87 */ 88 PJ_DEF(pj_status_t) pj_thread_create( pj_pool_t *pool, 89 const char *thread_name, 90 pj_thread_proc *proc, 91 void *arg, 92 pj_size_t stack_size, 93 unsigned flags, 94 pj_thread_t **ptr_thread) 95 { 96 pj_thread_t *rec; 97 int rc; 98 99 100 PJ_ASSERT_RETURN(pool && proc && ptr_thread, PJ_EINVAL); 101 102 /* Create thread record and assign name for the thread */ 103 rec = (struct pj_thread_t*) pj_pool_zalloc(pool, sizeof(pj_thread_t)); 104 PJ_ASSERT_RETURN(rec, PJ_ENOMEM); 105 106 /* Set name. */ 107 if (!thread_name) 108 thread_name = "thr%p"; 109 110 if (strchr(thread_name, '%')) { 111 pj_ansi_snprintf(rec->obj_name, PJ_MAX_OBJ_NAME, thread_name, rec); 112 } else { 113 strncpy(rec->obj_name, thread_name, PJ_MAX_OBJ_NAME); 114 rec->obj_name[PJ_MAX_OBJ_NAME-1] = '\0'; 115 } 116 117 118 /* Create the thread. */ 119 rec->proc = proc; 120 rec->arg = arg; 121 _LIT( KThreadName, "A name"); 122 rc = rec->thread.Create(KThreadName, thread_main, 4096, KMinHeapSize, 256*16, rec->arg, EOwnerProcess); 123 if (rc != 0) { 124 return PJ_RETURN_OS_ERROR(rc); 125 } 126 127 *ptr_thread = rec; 128 129 PJ_LOG(6, (rec->obj_name, "Thread created")); 130 return PJ_SUCCESS; 131 } 132 52 133 /////////////////////////////////////////////////////////////////////////////// 53 134 /* … … 66 147 } 67 148 149 class foodata 150 { 151 }; 152 68 153 /* 69 154 * pj_thread_local_set() … … 79 164 PJ_DEF(void*) pj_thread_local_get(long index) 80 165 { 81 return NULL; 166 return NULL; //Dll::Tls(); 82 167 } 83 168
Note: See TracChangeset
for help on using the changeset viewer.