Changeset 686
- Timestamp:
- Aug 15, 2006 11:04:34 PM (18 years ago)
- Location:
- pjproject/branches/symbian/pjlib
- Files:
-
- 2 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/branches/symbian/pjlib/build
- Property svn:ignore
-
old new 9 9 *.vcproj* 10 10 .gdb* 11 *.layout 12 *.cbp 13 .objs
-
- Property svn:ignore
-
pjproject/branches/symbian/pjlib/build/os-symbian.mak
r682 r686 8 8 # to all operating systems should go in Makefile instead. 9 9 # 10 export PJLIB_OBJS += addr_resolv_sock.o file_access_unistd.o \10 export PJLIB_OBJS += addr_resolv_sock.o file_access_unistd.o \ 11 11 file_io_ansi.o guid_simple.o \ 12 12 log_writer_stdout.o os_core_symbian.o \ 13 13 os_error_unix.o os_time_unix.o \ 14 14 os_timestamp_common.o os_timestamp_posix.o \ 15 pool_policy_malloc.o compat/string.o sock_bsd.o sock_select.o 15 pool_policy_malloc.o compat/string.o sock_bsd.o 16 export PJLIB_OBJS += sock_select_symbian.o ioqueue_symbian.o 17 16 18 17 19 # … … 31 33 # 32 34 #-L"C:\project\symbian\pjlib\lib" - 33 export TEST_LDFLAGS += -leexe.lib -leuser.lib -L. -lpj-symbian.lib35 export TEST_LDFLAGS += -leexe.lib -leuser.lib -L..\ -lpj-symbian.lib 34 36 35 37 # -
pjproject/branches/symbian/pjlib/build/pjlib.dsp
r458 r686 121 121 # Begin Source File 122 122 123 SOURCE=..\src\pj\os_core_symbian.cpp 124 # PROP Exclude_From_Build 1 125 # End Source File 126 # Begin Source File 127 123 128 SOURCE=..\src\pj\os_core_unix.c 124 129 # PROP Exclude_From_Build 1 … … 234 239 235 240 SOURCE=..\src\pj\ioqueue_select.c 236 237 !IF "$(CFG)" == "pjlib - Win32 Release"238 239 !ELSEIF "$(CFG)" == "pjlib - Win32 Debug"240 241 !ENDIF242 243 241 # End Source File 244 242 # Begin Source File … … 397 395 398 396 SOURCE=..\include\pj\compat\os_sunos.h 397 # End Source File 398 # Begin Source File 399 400 SOURCE=..\include\pj\compat\os_symbian.h 399 401 # End Source File 400 402 # Begin Source File -
pjproject/branches/symbian/pjlib/src/pj/os_core_symbian.cpp
r681 r686 1 /* $Id : os_core_unix.c 433 2006-05-10 19:24:40Z bennylp$ */1 /* $Id$ */ 2 2 /* 3 3 * Copyright (C)2003-2006 Benny Prijono <benny@prijono.org> … … 18 18 */ 19 19 20 //Auto-generated file. Please do not modify.21 20 #include <e32cmn.h> 22 21 #pragma data_seg(".SYMBIAN") … … 45 44 46 45 46 #define PJ_MAX_TLS 32 47 48 47 49 struct pj_thread_t 48 50 { 49 char obj_name[PJ_MAX_OBJ_NAME];50 RThread 51 char obj_name[PJ_MAX_OBJ_NAME]; 52 RThread *thread; 51 53 pj_thread_proc *proc; 52 54 void *arg; 53 55 unsigned flags; 56 void *tls_values[PJ_MAX_TLS]; 54 57 }; 55 58 56 /* 57 TODO: implement these stub methods! 58 */ 59 60 /* Flags to indicate which TLS variables have been used */ 61 static int tls_vars[PJ_MAX_TLS]; 62 63 64 65 PJ_DEF(pj_uint32_t) pj_getpid(void) 66 { 67 return 0; 68 } 69 59 70 60 71 /* … … 67 78 return PJ_SUCCESS; 68 79 } 80 69 81 70 82 /* … … 73 85 * This is the main entry for all threads. 74 86 */ 75 TInt thread_main(TAny *param)87 static TInt thread_main(TAny *param) 76 88 { 77 89 pj_thread_t *rec = (pj_thread_t *) param; 78 90 TInt result; 79 /* pj_status_t rc; */ 91 92 /* Save thread record to Symbian TLS */ 93 Dll::SetTls(rec); 94 95 /* Suspend thread if PJ_THREAD_SUSPENDED is specified */ 96 if (rec->flags & PJ_THREAD_SUSPENDED) 97 rec->thread->Suspend(); 80 98 81 99 PJ_LOG(6,(rec->obj_name, "Thread started")); … … 102 120 { 103 121 pj_thread_t *rec; 122 void *p; 104 123 int rc; 105 124 … … 122 141 } 123 142 143 /* Create Symbian RThread object */ 144 p = pj_pool_alloc(pool, sizeof(RThread)); 145 rec->thread = new (p) RThread; 124 146 125 147 /* Create the thread. */ 126 148 rec->proc = proc; 127 149 rec->arg = arg; 150 rec->flags = flags; 128 151 _LIT( KThreadName, "Athread"); 129 rc = rec->thread.Create(KThreadName, thread_main, 4096, KMinHeapSize, 256*16, rec->arg, EOwnerThread); 152 rc = rec->thread->Create(KThreadName, &thread_main, stack_size, 153 KMinHeapSize, KMinHeapSize, rec); 130 154 if (rc != 0) { 131 155 return PJ_RETURN_OS_ERROR(rc); … … 143 167 PJ_DEF(const char*) pj_thread_get_name(pj_thread_t *p) 144 168 { 145 pj_thread_t *rec = (pj_thread_t*)p; 146 147 return rec->obj_name; 169 return p->obj_name; 148 170 } 149 171 … … 153 175 PJ_DEF(pj_status_t) pj_thread_resume(pj_thread_t *p) 154 176 { 155 pj_status_t rc; 156 157 pj_thread_t *rec = (pj_thread_t*)p; 158 159 rec->thread.Resume(); 160 161 rc = PJ_SUCCESS; 162 163 return rc; 177 p->thread->Resume(); 178 return PJ_SUCCESS; 164 179 } 165 180 … … 169 184 PJ_DEF(pj_thread_t*) pj_thread_this(void) 170 185 { 171 // TODO 172 return NULL; 186 return (pj_thread_t*)Dll::Tls(); 173 187 } 174 188 … … 176 190 * pj_thread_join() 177 191 */ 178 PJ_DEF(pj_status_t) pj_thread_join(pj_thread_t *p) 179 { 180 pj_thread_t *rec = (pj_thread_t *)p; 192 PJ_DEF(pj_status_t) pj_thread_join(pj_thread_t *rec) 193 { 181 194 TRequestStatus result; 182 195 183 //PJ_LOG(6, (pj_thread_this()->obj_name, "Joining thread %s", p->obj_name));184 185 rec->thread .Rendezvous(result);196 PJ_LOG(6, (rec->obj_name, "Joining thread %s", rec->obj_name)); 197 198 rec->thread->Rendezvous(result); 186 199 187 200 return PJ_SUCCESS; … … 191 204 * pj_thread_destroy() 192 205 */ 193 PJ_DEF(pj_status_t) pj_thread_destroy(pj_thread_t *p) 194 { 195 pj_thread_t *rec = (pj_thread_t *)p; 196 rec->thread.Kill(1); 197 198 206 PJ_DEF(pj_status_t) pj_thread_destroy(pj_thread_t *rec) 207 { 208 rec->thread->Kill(1); 199 209 return PJ_SUCCESS; 200 210 } … … 205 215 PJ_DEF(pj_status_t) pj_thread_sleep(unsigned msec) 206 216 { 217 PJ_TODO(MSEC_RESOLUTION_SLEEP); 218 207 219 if (sleep(msec * 1000) == 0) 208 220 return PJ_SUCCESS; … … 219 231 PJ_DEF(pj_status_t) pj_thread_local_alloc(long *index) 220 232 { 233 unsigned i; 234 235 /* Find unused TLS variable */ 236 for (i=0; i<PJ_ARRAY_SIZE(tls_vars); ++i) { 237 if (tls_vars[i] == 0) 238 break; 239 } 240 241 if (i == PJ_ARRAY_SIZE(tls_vars)) 242 return PJ_ETOOMANY; 243 244 tls_vars[i] = 1; 245 *index = i; 246 221 247 return PJ_SUCCESS; 222 248 } … … 227 253 PJ_DEF(void) pj_thread_local_free(long index) 228 254 { 229 } 230 231 class foodata 232 { 233 }; 255 PJ_ASSERT_ON_FAIL(index >= 0 && index < PJ_ARRAY_SIZE(tls_vars) && 256 tls_vars[index] != 0, return); 257 258 tls_vars[index] = 0; 259 } 260 234 261 235 262 /* … … 238 265 PJ_DEF(pj_status_t) pj_thread_local_set(long index, void *value) 239 266 { 267 pj_thread_t *rec = pj_thread_this(); 268 269 PJ_ASSERT_RETURN(index >= 0 && index < PJ_ARRAY_SIZE(tls_vars) && 270 tls_vars[index] != 0, PJ_EINVAL); 271 272 rec->tls_values[index] = value; 240 273 return PJ_SUCCESS; 241 274 } … … 246 279 PJ_DEF(void*) pj_thread_local_get(long index) 247 280 { 248 return NULL; //Dll::Tls(); 249 } 250 281 pj_thread_t *rec = pj_thread_this(); 282 283 PJ_ASSERT_RETURN(index >= 0 && index < PJ_ARRAY_SIZE(tls_vars) && 284 tls_vars[index] != 0, NULL); 285 286 return rec->tls_values[index]; 287 } 288 289 290 PJ_DEF(pj_status_t) pj_mutex_create( pj_pool_t *pool, 291 const char *name, 292 int type, 293 pj_mutex_t **mutex) 294 { 295 PJ_TODO(pj_mutex_create); 296 *mutex = (pj_mutex_t*)1; 297 return PJ_SUCCESS; 298 } 251 299 252 300 /* … … 257 305 pj_mutex_t **mutex ) 258 306 { 259 (*mutex) = (pj_mutex_t *)1; 260 return PJ_SUCCESS; 261 } 307 return pj_mutex_create(pool, name, PJ_MUTEX_SIMPLE, mutex); 308 } 309 310 311 PJ_DEF(pj_status_t) pj_mutex_create_recursive( pj_pool_t *pool, 312 const char *name, 313 pj_mutex_t **mutex ) 314 { 315 return pj_mutex_create(pool, name, PJ_MUTEX_RECURSE, mutex); 316 } 317 262 318 263 319 /* … … 266 322 PJ_DEF(pj_status_t) pj_mutex_lock(pj_mutex_t *mutex) 267 323 { 324 PJ_TODO(pj_mutex_lock); 268 325 return PJ_SUCCESS; 269 326 } … … 274 331 PJ_DEF(pj_status_t) pj_mutex_trylock(pj_mutex_t *mutex) 275 332 { 333 PJ_TODO(pj_mutex_trylock); 276 334 return PJ_SUCCESS; 277 335 } … … 282 340 PJ_DEF(pj_status_t) pj_mutex_unlock(pj_mutex_t *mutex) 283 341 { 342 PJ_TODO(pj_mutex_unlock); 284 343 return PJ_SUCCESS; 285 344 } … … 290 349 PJ_DEF(pj_status_t) pj_mutex_destroy(pj_mutex_t *mutex) 291 350 { 292 return PJ_SUCCESS; 293 } 351 PJ_TODO(pj_mutex_destroy); 352 return PJ_SUCCESS; 353 } 354 355 ///////////////////////////////////////////////////////////////////////////// 356 357 /* 358 * Enter critical section. 359 */ 360 PJ_DEF(void) pj_enter_critical_section(void) 361 { 362 PJ_TODO(pj_enter_critical_section); 363 } 364 365 366 /* 367 * Leave critical section. 368 */ 369 PJ_DEF(void) pj_leave_critical_section(void) 370 { 371 PJ_TODO(pj_leave_critical_section); 372 } 373 374 375 376
Note: See TracChangeset
for help on using the changeset viewer.