This is to wait for the reading thread to stop using the file object
while cleaning up.
Signed-off-by: Keith Packard <keithp@keithp.com>
return BT_PORT_DEFAULT;
}
-#include <time.h>
-
PUBLIC void
altos_free(struct altos_file *file)
{
int i;
altos_close(file);
- for (i = 0; i < 10 && file->busy; i++) {
- struct timespec delay = { .tv_sec = 1, .tv_nsec = 0 };
- nanosleep(&delay, NULL);
- }
+ for (i = 0; i < 10 && file->busy; i++)
+ altos_pause_one_second();
free(file);
}
return 0;
}
+#include <time.h>
+
+void
+altos_pause_one_second(void)
+{
+ struct timespec delay = { .tv_sec = 1, .tv_nsec = 0 };
+ nanosleep(&delay, NULL);
+}
int
altos_bt_port(struct altos_bt_device *device);
+void
+altos_pause_one_second(void);
+
#endif /* _LIBALTOS_PRIVATE_H_ */
}
return &file->file;
}
+
+void
+altos_pause_one_second(void)
+{
+ Sleep(1000);
+}