Multi-task mutual exclusion method and system based on file lock
The invention provides a multi-task mutual exclusion method and system based on a file lock, and the method comprises the steps: opening a device node file and obtaining a file descriptor fd when a multi-task access critical region of the same device node file operation is operated; performing locki...
Gespeichert in:
Hauptverfasser: | , , , |
---|---|
Format: | Patent |
Sprache: | chi ; eng |
Schlagworte: | |
Online-Zugang: | Volltext bestellen |
Tags: |
Tag hinzufügen
Keine Tags, Fügen Sie den ersten Tag hinzu!
|
Zusammenfassung: | The invention provides a multi-task mutual exclusion method and system based on a file lock, and the method comprises the steps: opening a device node file and obtaining a file descriptor fd when a multi-task access critical region of the same device node file operation is operated; performing locking operation on the equipment node file corresponding to the file descriptor fd based on a file lock, and updating the value of the global variable by using the file descriptor fd after the locking operation succeeds and when the value of the global variable is judged to be an initial value; after the locking operation fails, entering a blocking waiting state, and delaying and repeating the locking operation until the locking succeeds; and after the task is completed, obtaining a file descriptor fd by checking the value of the global variable, performing unlocking operation on the equipment node file corresponding to the file descriptor fd based on the file lock, closing the equipment node file corresponding to the |
---|