Commit 07e6627a authored by 957dd's avatar 957dd

shell bug update and join opensh pthread

parent 3384b318
......@@ -3,7 +3,7 @@
pkill firefox
# 设置 DISPLAY 环境变量(确保 Firefox 能运行图形界面)
# 设置 DISPLAY 环境变量(确保 Firefox 能运行图形界面)--new-window
export DISPLAY=:0
sudo firefox --new-window "https://8.129.3.163/index" --ignore-certificate-errors &
\ No newline at end of file
sudo firefox "https://8.129.3.163/index" --ignore-certificate-errors
\ No newline at end of file
This diff is collapsed.
No preview for this file type
......@@ -5,6 +5,12 @@
#include "delay.h"
#include "opensh.h"
void *opensh(void *arg)
{
sleep(10);
opencamsh();
return NULL;
}
void *serial_usart1(void *arg)
{
......@@ -82,9 +88,9 @@ int main(int argc, char *argv[]) {
ipaddr();//获取ip
mqtt_wirte();//mqtt心跳首次发送
opencamsh();
//opencamsh();
thread_start(serial_usart1,AppExit,Mqttbeat,serial_usart2);
thread_start(serial_usart1,AppExit,Mqttbeat,serial_usart2,opensh);
mqtt_cycle(mosq);
......
......@@ -6,12 +6,12 @@
#include "serial.h"
#include "delay.h"
pthread_t thread[4];
pthread_t thread[5];
int thread_start(void *serial_usart1(void *arg),void *AppExit(void *arg),void *Mqttbeat(void *arg),void *serial_usart2(void *arg))
int thread_start(void *serial_usart1(void *arg),void *AppExit(void *arg),void *Mqttbeat(void *arg),void *serial_usart2(void *arg),void *opensh(void *arg))
{
......@@ -38,6 +38,12 @@ int thread_start(void *serial_usart1(void *arg),void *AppExit(void *arg),void *M
perror("Failed to create thread 1");
return 4;
}
if(pthread_create(&thread[4],NULL,opensh,NULL)!=0)
{
perror("Failed to create thread 1");
return 5;
}
}
void thread_end()
......@@ -52,6 +58,8 @@ void thread_end()
pthread_join(thread[2], NULL);
pthread_join(thread[3], NULL);
pthread_join(thread[4], NULL);
}
#endif
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment