* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
#include <stdlib.h>
#include <Ecore.h>
+#include <pthread.h>
+
#include "ttsd_main.h"
#include "ttsd_ipc.h"
#include "ttsd_data.h"
rpc_port_stub_tts_callback_s g_callback;
+static pthread_mutex_t g_tidl_proxy_infos_mutex = PTHREAD_MUTEX_INITIALIZER;
+
+
static tts_tidl_proxy_info_s* __get_tidl_proxy_info_s(int uid)
{
GList* iter = NULL;
void __send_msg(int pid, int uid, bundle* msg)
{
SLOG(LOG_INFO, tts_tag(), "[TIDL] start : send msg : pid(%d), uid(%d)", pid, uid);
+ pthread_mutex_lock(&g_tidl_proxy_infos_mutex);
tts_tidl_proxy_info_s* info = __get_tidl_proxy_info_s(uid);
if (NULL == info) {
SLOG(LOG_ERROR, tts_tag(), "[TIDL] Uid is not valid. pid(%d), uid(%d)", pid, uid);
+ pthread_mutex_unlock(&g_tidl_proxy_infos_mutex);
return;
}
rpc_port_tts_notify_cb_h handle = info->notify_cb_h;
if (NULL == handle) {
SLOG(LOG_INFO, tts_tag(), "notify callback handle null");
+ pthread_mutex_unlock(&g_tidl_proxy_infos_mutex);
return;
}
if (0 != rpc_port_tts_notify_cb_invoke(handle, pid, uid, msg)) {
SLOG(LOG_ERROR, tts_tag(), "[Server ERROR] Fail to send msg");
+ pthread_mutex_unlock(&g_tidl_proxy_infos_mutex);
return;
}
SLOG(LOG_INFO, tts_tag(), "send msg : pid(%d), uid(%d)", pid, uid);
+ pthread_mutex_unlock(&g_tidl_proxy_infos_mutex);
}
static void __create_client_cb(rpc_port_stub_tts_context_h context, void *user_data)
}
info->uid = uid;
+ pthread_mutex_lock(&g_tidl_proxy_infos_mutex);
g_tidl_proxy_infos = g_list_append(g_tidl_proxy_infos, info);
+ pthread_mutex_unlock(&g_tidl_proxy_infos_mutex);
SLOG(LOG_INFO, tts_tag(), "create player instance");
ttsdc_tidl_send_hello(pid, uid, ret, credential_needed);
}
info->uid = uid;
+ pthread_mutex_lock(&g_tidl_proxy_infos_mutex);
g_tidl_proxy_infos = g_list_append(g_tidl_proxy_infos, info);
+ pthread_mutex_unlock(&g_tidl_proxy_infos_mutex);
SLOG(LOG_ERROR, tts_tag(), "<<<<<<<<<<<");
return -1;
}
+ pthread_mutex_lock(&g_tidl_proxy_infos_mutex);
tts_tidl_proxy_info_s* info = __get_tidl_proxy_info_s(uid);
if (NULL == info) {
SLOG(LOG_ERROR, tts_tag(), "[TIDL ERROR] Fail to set notify callback");
+ pthread_mutex_unlock(&g_tidl_proxy_infos_mutex);
return TTSD_ERROR_INVALID_PARAMETER;
}
SLOG(LOG_DEBUG, tts_tag(), "<<<<<");
+ pthread_mutex_unlock(&g_tidl_proxy_infos_mutex);
return TTSE_ERROR_NONE;
}