Commit 57d5947
committed
Improve concurrent file access
If the device file is opened twice concurrently, closing one of them
will clear configurations such as the timer and fast_buf, leading to
errors in the other operation. Therefore, considering the state under
concurrency, an atomic_t type variable named open_cnt is added to
track the number of opens. The original settings operations will only
be performed when it is the first open or the last close.1 parent d92dffe commit 57d5947
1 file changed
+13
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
282 | 282 | | |
283 | 283 | | |
284 | 284 | | |
| 285 | + | |
| 286 | + | |
285 | 287 | | |
286 | 288 | | |
287 | 289 | | |
288 | | - | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
289 | 294 | | |
290 | 295 | | |
291 | 296 | | |
292 | 297 | | |
293 | 298 | | |
294 | 299 | | |
295 | | - | |
296 | | - | |
297 | | - | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
298 | 306 | | |
299 | 307 | | |
300 | 308 | | |
| |||
361 | 369 | | |
362 | 370 | | |
363 | 371 | | |
| 372 | + | |
364 | 373 | | |
365 | 374 | | |
366 | 375 | | |
| |||
0 commit comments