I trying to make my service run in another thread using the Threding lib
I did the following:
I move al my Service_Create code to the ThreadSub1 and replace it with the start thread code
I initiate a parser, an Sql object and a timer and run the timer_tick
When I run it I get an inmediate Thead_Ended error:
Exception : wrong number of arguments; expected 4, got 0
How can I do it?
Thanks
I did the following:
B4X:
Sub Process_Globals
Dim Thread1 As Thread
Dim Lock1 As Lock
Dim end1 As Int
Dim ok As Boolean
Dim msg As String
I move al my Service_Create code to the ThreadSub1 and replace it with the start thread code
B4X:
Sub Service_Create
Thread1.Initialise("Thread1")
Dim args(0) As Object
Lock1.Initialize(True)
Thread1.Name = "B4A Thread 1"
Thread1.Start(Null, "ThreadSub1", args)
End Sub
I initiate a parser, an Sql object and a timer and run the timer_tick
B4X:
Sub ThreadSub1
parser.Initialize
SQL1.Initialize(File.DirDefaultExternal, "portit.db", True)
Timer1.Initialize("Timer1", 10000) ' 1000 = 1 second
Timer1.Enabled = True
Timer1_Tick
End Sub
Sub Thread1_Ended(fail As Boolean, error As String) 'An error or Exception has occurred in the Thread
Msgbox(error, "Thread1 Ended")
End Sub
When I run it I get an inmediate Thead_Ended error:
Exception : wrong number of arguments; expected 4, got 0
How can I do it?
Thanks