[Gambas-user] A Task Issue

Jorge Carrión shordi at gmail.com
Wed Mar 7 13:35:51 CET 2018


2018-03-07 12:18 GMT+01:00 Benoît Minisini <g4mba5 at gmail.com>:

> Le 07/03/2018 à 10:21, Jorge Carrión a écrit :
>
>> Hi everyone,
>> I'm doing a Mail Checker using a task. It checks Mail in a timer interval
>> of 10 seconds and send a desktop notify if there is new incoming mail. It
>> seems work well but after a time it hangs.
>> The check mail process is done by a task and I guess that there is
>> something I missed about handling tasks.
>>
>> Each time the task checks mail a process of openssl remains open even the
>> task is stoped and/or destroyed (null).
>>
>> Someone can help me about this? I've attached a little working example
>> and the picture of the process list remaining after each mail check.
>>
>> Thanks in advance
>>
>> Best Regards
>>
>>
>>
> What you didn't understand is that a Task does not run in the same process!
>
> If you call tc.CheckMail() from the main process, you just run the method
> in the main process. The task does nothing. Only the task Main() method is
> automatically called in the task context (and then every other method
> called from the Main() method).
>
> And you have to close the Pop3Client in all cases, which you do not, check
> your code. I think this is the reason why the openssl processes still run.


Benoît:
This seems the solution indeed. It was really that: I don't understand that
task doesn't run in same process.
Another question:
Can be more than one task simultaneously?
I've tried to do so and the program abort with code 6 and this message on
console:

"[xcb] Most likely this is a multi-threaded client and XInitThreads has not
been called
[xcb] Aborting, sorry about that.
gbx3: ../../src/xcb_io.c:274: poll_for_event: La declaración
`!xcb_xlib_threads_sequence_lost' no se cumple."

2018-03-07 11:58 GMT+01:00 Jorge Carrión <shordi at gmail.com>:

> Thanks for your interest, Gianluigi.
>
> Best regards
>
> 2018-03-07 11:38 GMT+01:00 Gianluigi <bagonergi at gmail.com>:
>
>> No Jorge,
>> I'm sorry I said nonsense, the dec of your code works well.
>>
>> Regards
>> Gianluigi
>>
>> 2018-03-07 11:17 GMT+01:00 Gianluigi <bagonergi at gmail.com>:
>>
>>> Hi Jorge,
>>> I just looked at the code and I see that in bCheckMail_Click() is
>>> missing, I do not know if it can be useful.
>>>
>>>     Else
>>>         Balloon(("Can't connect with mailserver. Check your data."),
>>> bCheckMail)
>>>         mailAccount.Clear()
>>>         lOk = False
>>>         ' Missing Dec Application.Busy ' or
>>>         Application.Busy = 0
>>>     Endif
>>>
>>> Regards
>>> Gianluigi
>>>
>>> 2018-03-07 10:21 GMT+01:00 Jorge Carrión <shordi at gmail.com>:
>>>
>>>> Hi everyone,
>>>> I'm doing a Mail Checker using a task. It checks Mail in a timer
>>>> interval of 10 seconds and send a desktop notify if there is new incoming
>>>> mail. It seems work well but after a time it hangs.
>>>> The check mail process is done by a task and I guess that there is
>>>> something I missed about handling tasks.
>>>>
>>>> Each time the task checks mail a process of openssl remains open even
>>>> the task is stoped and/or destroyed (null).
>>>>
>>>> Someone can help me about this? I've attached a little working example
>>>> and the picture of the process list remaining after each mail check.
>>>>
>>>> Thanks in advance
>>>>
>>>> Best Regards
>>>>
>>>>
>>>> --------------------------------------------------
>>>>
>>>> This is the Gambas Mailing List:
>>>> https://lists.gambas-basic.org/listinfo/user
>>>>
>>>> Search the list:
>>>> https://lists.gambas-basic.org/cgi-bin/search.cgi
>>>>
>>>> Hosted by https://www.hostsharing.net
>>>>
>>>>
>>>
>>
>>
>> --------------------------------------------------
>>
>> This is the Gambas Mailing List:
>> https://lists.gambas-basic.org/listinfo/user
>>
>> Search the list:
>> https://lists.gambas-basic.org/cgi-bin/search.cgi
>>
>> Hosted by https://www.hostsharing.net
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20180307/375882ef/attachment.html>


More information about the User mailing list