Changeset 3510


Ignore:
Timestamp:
Apr 8, 2011 4:05:25 AM (11 years ago)
Author:
ming
Message:

Re #1214: Add Mac OS X compatibility for pjsua

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/branches/projects/2.0-dev/pjsip-apps/src/pjsua/main.c

    r3485 r3510  
    2121#include <pjsua-lib/pjsua.h> 
    2222 
     23#if defined(PJ_DARWINOS) && PJ_DARWINOS!=0 
     24#   include <CoreFoundation/CFRunLoop.h> 
     25#endif 
     26 
    2327#define THIS_FILE       "main.c" 
    2428 
     
    2832 */ 
    2933extern pj_bool_t app_restart; 
     34pj_bool_t is_quit = PJ_FALSE; 
    3035pj_status_t app_init(int argc, char *argv[]); 
    3136pj_status_t app_main(void); 
     
    7681#endif 
    7782 
     83#if defined(PJ_DARWINOS) && PJ_DARWINOS!=0 
     84static int main_func(void *data); 
     85int argc; 
     86char **argv; 
     87 
     88int main(int argcm, char *argvm[]) 
     89{  
     90    pthread_t thread; 
     91 
     92    argc = argcm; 
     93    argv = (char **)argvm; 
     94    if (pthread_create(&thread, NULL, &main_func, NULL) == 0) { 
     95        while (!is_quit) { 
     96            CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0, false); 
     97        } 
     98    } 
     99 
     100    return 0; 
     101} 
     102static int main_func(void *data) 
     103#else 
    78104int main(int argc, char *argv[]) 
     105#endif 
    79106{ 
    80107    do { 
     
    93120    } while (app_restart); 
    94121 
     122    is_quit = PJ_TRUE; 
    95123    return 0; 
    96124} 
Note: See TracChangeset for help on using the changeset viewer.