Ignore:
Timestamp:
Aug 14, 2006 12:55:27 AM (18 years ago)
Author:
ismangil
Message:

Work in progress. Compile and links cleanly. Executes in console mode still buggy.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/branches/symbian/pjlib/src/pj/os_core_symbian.cpp

    r666 r680  
    6666 * This is the main entry for all threads. 
    6767 */ 
    68 TInt *thread_main(TAny *param) 
     68TInt thread_main(TAny *param) 
    6969{ 
    7070    pj_thread_t *rec = (pj_thread_t *) param; 
    71     TInt *result; 
     71    TInt result; 
    7272    /* pj_status_t rc; */ 
    7373 
     
    7575 
    7676    /* Call user's entry! */ 
    77     result = (TInt*)(long)(*rec->proc)(rec->arg); 
     77    result = (TInt)(*rec->proc)(rec->arg); 
    7878 
    7979    /* Done. */ 
     
    119119    rec->proc = proc; 
    120120    rec->arg = arg; 
    121     _LIT( KThreadName, "A name"); 
    122     rc = rec->thread.Create(KThreadName, thread_main, 4096, KMinHeapSize, 256*16, rec->arg, EOwnerProcess); 
     121    _LIT( KThreadName, "Athread"); 
     122    rc = rec->thread.Create(KThreadName, thread_main, 4096, KMinHeapSize, 256*16, rec->arg, EOwnerThread); 
    123123    if (rc != 0) { 
    124124        return PJ_RETURN_OS_ERROR(rc); 
     
    131131} 
    132132 
     133/* 
     134 * pj_thread-get_name() 
     135 */ 
     136PJ_DEF(const char*) pj_thread_get_name(pj_thread_t *p) 
     137{ 
     138    pj_thread_t *rec = (pj_thread_t*)p; 
     139 
     140    return rec->obj_name; 
     141} 
     142 
     143/* 
     144 * pj_thread_resume() 
     145 */ 
     146PJ_DEF(pj_status_t) pj_thread_resume(pj_thread_t *p) 
     147{ 
     148    pj_status_t rc; 
     149 
     150    pj_thread_t *rec = (pj_thread_t*)p; 
     151 
     152    rec->thread.Resume(); 
     153 
     154    rc = PJ_SUCCESS; 
     155 
     156    return rc; 
     157} 
     158 
     159/* 
     160 * pj_thread_this() 
     161 */ 
     162PJ_DEF(pj_thread_t*) pj_thread_this(void) 
     163{ 
     164    // TODO 
     165    return NULL; 
     166} 
     167 
     168/* 
     169 * pj_thread_join() 
     170 */ 
     171PJ_DEF(pj_status_t) pj_thread_join(pj_thread_t *p) 
     172{ 
     173    pj_thread_t *rec = (pj_thread_t *)p; 
     174    TRequestStatus result; 
     175 
     176    //PJ_LOG(6, (pj_thread_this()->obj_name, "Joining thread %s", p->obj_name)); 
     177 
     178    rec->thread.Rendezvous(result); 
     179 
     180    return PJ_SUCCESS; 
     181} 
     182 
     183/* 
     184 * pj_thread_destroy() 
     185 */ 
     186PJ_DEF(pj_status_t) pj_thread_destroy(pj_thread_t *p) 
     187{ 
     188    pj_thread_t *rec = (pj_thread_t *)p; 
     189    rec->thread.Kill(1); 
     190         
     191 
     192    return PJ_SUCCESS; 
     193} 
     194 
     195/* 
     196 * pj_thread_sleep() 
     197 */ 
     198PJ_DEF(pj_status_t) pj_thread_sleep(unsigned msec) 
     199{ 
     200    if (sleep(msec * 1000) == 0) 
     201        return PJ_SUCCESS; 
     202} 
     203 
     204 
    133205/////////////////////////////////////////////////////////////////////////////// 
    134206/* 
    135207 * pj_thread_local_alloc() 
    136208 */ 
     209 
    137210PJ_DEF(pj_status_t) pj_thread_local_alloc(long *index) 
    138211{ 
     
    175248                                            pj_mutex_t **mutex ) 
    176249{ 
     250    (*mutex) = (pj_mutex_t *)1; 
    177251    return PJ_SUCCESS; 
    178252} 
     
    187261 
    188262/* 
     263 * pj_mutex_trylock() 
     264 */ 
     265PJ_DEF(pj_status_t) pj_mutex_trylock(pj_mutex_t *mutex) 
     266{ 
     267    return PJ_SUCCESS; 
     268} 
     269 
     270/* 
    189271 * pj_mutex_unlock() 
    190272 */ 
Note: See TracChangeset for help on using the changeset viewer.