<?php

define('BASE_ROOT_PATH',str_replace('\\','/',dirname(__FILE__)));
define('MOBILE_SERVER',true);

require_once (BASE_ROOT_PATH . '/fooder.php');
require_once (BASE_ROOT_PATH . '/helper/http_header.php');
require_once (BASE_ROOT_PATH . '/helper/session.php');
require_once (BASE_ROOT_PATH . '/helper/img_helper.php');
require_once (BASE_ROOT_PATH . '/helper/exceptionex.php');
require_once (BASE_ROOT_PATH . '/helper/fcgi_server.php');
require_once (BASE_ROOT_PATH . '/helper/message/msgutil.php');
require_once (BASE_ROOT_PATH . '/helper/message/subscriber.php');
require_once (BASE_ROOT_PATH . '/helper/index_tab.php');

function all_channels()
{
    return array('ch_index','activity','goods');
}

Base::mobile_init();

$trdid = Thread::getCurrentThreadId();
Log::record("thread id = {$trdid}",Log::INFO);

$gMessageStates = new MsgStates();
StatesHelper::init();
$gMessageLock = Mutex::create();
$listener = new message\subscriber($gMessageStates,$gMessageLock);
$listener->start();

fcgi_server::instance()->run_looper();