The invention discloses a lockless multithread
data synchronization method. The method includes the following steps that A, a main thread receives information and dispatches and processes information; B, whether child threads are in the suspended state or not is judged, if yes, the step C is executed, and if not, no operation is executed; C, the main thread creates a
queue 1, files in the
queue 1 are copied to a
queue 2, and then data in the queue 1 are eliminated; D, a
signal object is set through the main thread to be in the state with signals; E, the child threads obtain signals,
traverse files in the queue 2 and circularly call and load objects, and the created objects are inserted into a queue 3; F, whether the child threads are in the suspended state or not is judged, if yes, the step G is executed, and if not, no operation is executed; G, data in the queue 3 are copied to a queue 4 through the main thread, and the data in the queue 3 are eliminated; H, the created objects are inserted into the queue 1, and the
signal object is set to be in the state with signals. By means of the lockless multithread
data synchronization method, the problem that
deadlock phenomenon happens to access objects of the main thread and the child threads is solved.