Problem with perform in thread

[Migrated content. Thread originally posted on 28 September 2011]


I'm getting freeze problems in my program when i do:

perform in thread Lectura_Scanner handle in scanner-thread
until scanner-activo-no

       Lectura_Scanner section.
           initialize sca-envio-scanner.
           call "s$balanza" using by content sca-puerto
                                  by content sca-envio-scanner
                                  by content sca-velocidad
                                  by content sca-paridad
                                  by content sca-bits-datos
                                  by content sca-bits-parada
                                  by reference sca-lectura
           on exception
              move "s$balanza" to calling-program
              perform errcall
           not on exception
           cancel "s$balanza".
       Lectura_Scanner section.

The problem happens when the subthread do the call "s$balanza", the main thread gets totally freeze until the call ends. Inside "s$balanza" there is some calls to windows api to scan a COM port and the program can wait to get response from the com port and for that i put "s$balanza" in a thread.

I'm a bit lost because normally a subthread must not stop the process of the mainthread... is the reason to use different threads.

¿Any tips?