Sync data before closing port
This commit is contained in:
parent
057184ba3d
commit
4502ae3a9a
|
@ -2,7 +2,7 @@
|
||||||
* SerialPort_Posix.c
|
* SerialPort_Posix.c
|
||||||
*
|
*
|
||||||
* Created on: Feb 25, 2012
|
* Created on: Feb 25, 2012
|
||||||
* Last Updated on: Feb 25, 2020
|
* Last Updated on: Apr 01, 2020
|
||||||
* Author: Will Hedgecock
|
* Author: Will Hedgecock
|
||||||
*
|
*
|
||||||
* Copyright (C) 2012-2020 Fazecast, Inc.
|
* Copyright (C) 2012-2020 Fazecast, Inc.
|
||||||
|
@ -525,6 +525,7 @@ JNIEXPORT jboolean JNICALL Java_com_fazecast_jSerialComm_SerialPort_closePortNat
|
||||||
|
|
||||||
// Close the port
|
// Close the port
|
||||||
flock(serialPortFD, LOCK_UN | LOCK_NB);
|
flock(serialPortFD, LOCK_UN | LOCK_NB);
|
||||||
|
fdatasync(serialPortFD);
|
||||||
while ((close(serialPortFD) == -1) && (errno == EINTR))
|
while ((close(serialPortFD) == -1) && (errno == EINTR))
|
||||||
errno = 0;
|
errno = 0;
|
||||||
(*env)->SetLongField(env, obj, serialPortFdField, -1l);
|
(*env)->SetLongField(env, obj, serialPortFdField, -1l);
|
||||||
|
|
Loading…
Reference in New Issue