summaryrefslogtreecommitdiff
path: root/src/sapp_dev/sapp_plug.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/sapp_dev/sapp_plug.c')
-rw-r--r--src/sapp_dev/sapp_plug.c35
1 files changed, 25 insertions, 10 deletions
diff --git a/src/sapp_dev/sapp_plug.c b/src/sapp_dev/sapp_plug.c
index 78b3f11..cedac25 100644
--- a/src/sapp_dev/sapp_plug.c
+++ b/src/sapp_dev/sapp_plug.c
@@ -71,12 +71,13 @@ static void show_mesa_log(void)
for(i = 0; (i < sizeof(MESA_art_log)) && (MESA_art_log[i] != 0); i ++){
//putchar(MESA_log[i]);
- printf("%c", MESA_art_log[i]);
+ sapp_printf("%c", MESA_art_log[i]);
}
- printf("\n");
+ sapp_printf("\n");
sapp_runtime_log(30, "\n\n%s", MESA_art_log);
}
+/* �����ȴ���Ҫ���߳�������� */
static void sapp_wait_for_required_thread_starting(void)
{
int tseq;
@@ -92,6 +93,17 @@ static void sapp_wait_for_required_thread_starting(void)
}
}
+static void *sapp_monitor_thread(void *args)
+{
+ while(sapp_get_current_state() == SAPP_STATE_PROCESSING){
+ usleep(1000);
+ }
+
+ libsapp_destroy_env();
+
+ return NULL;
+}
+
int libsapp_setup_env(int argc, char *argv[])
{
@@ -148,14 +160,17 @@ int libsapp_setup_env(int argc, char *argv[])
sapp_wait_for_required_thread_starting();
- //TODO: dumpfileģʽ���������Զ��˳�, ����һֱ����
- //�������ź�, �����������߳�ǿ�е���sapp_destroy_env()
-#if 0
- while((SAPP_STATE_PROCESSING == sapp_global_val->individual_volatile->current_state)
- && (sapp_global_val->config.packet_io.depolyment_mode_bin)){
- usleep(1);
- }
-#endif
+ /*
+ ���г�ʼ���͹����̶߳���������,
+ �ó�cpu, ����ģ�����libsapp_setup_env()֮����Լ���ִ��, �����DZ�����, ��������߼��ͺ��Ѵ���.
+ dumpfileģʽ���������Զ��˳�, ����һֱ����,
+ �����������߳�ǿ�е���libsapp_destroy_env()
+ */
+
+ pthread_t pid;
+ pthread_create(&pid, NULL, sapp_monitor_thread, NULL);
+ pthread_detach(pid);
+
return 0;
}