我正在使用两个脚本,一个在指定的串口上执行写操作,第二个脚本不断从中读取。
我需要在此串口上安装互斥锁,以确保一次只有一个脚本使用串口。
Reading script:
./Read -p {myserialport} -v $2 -r $3
Writing script:
./Write -p {myserialport} -v $2 -r $3
I need to transform this into:
Reading script:
//GET mutex on {myserialport}
./Read -p {myserialport} -v $2 -r $3
//RELEASE
Writing script:
//GET mutex on {myserialport}
./Write -p {myserialport} -v $2 -r $3
//RELEASE