[erlang-questions] Gracefully timeout during erlang:port_call/3?

zabrane Mikael zabrane3@REDACTED
Thu Oct 7 08:12:27 CEST 2010


2010/10/6 Ahmed Omar <spawn.think@REDACTED>:
> Not sure if there is a graceful way , but you can spawn the call in a
> process that will be terminated after some timeout.

That's the simple way to do it.

> This will terminate the calling process, but if it will affect the port driver depends i guess it
> depends on the port
> timer:kill_after(Timeout, spawn(erlang, port_call, [Port, Operation, Data])).

But this can crash my port program.
Any other advice guys?

-- 
Regards
Zabrane


>
> On Mon, Oct 4, 2010 at 1:58 AM, zabrane Mikael <zabrane3@REDACTED> wrote:
>>
>> Hi guys,
>>
>> Is there a way to gracefully timeout (i.e without crashing the port
>> driver) during the synchronous call to "erlang:port_call/3"?
>> The idea here is to try to timeout if the port takes long time to return.
>>
>> Any advice is welcome?
>> --
>> Regards
>> Zabrane
>>
>> ________________________________________________________________
>> erlang-questions (at) erlang.org mailing list.
>> See http://www.erlang.org/faq.html
>> To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED
>>
>
>
>
> --
> Best Regards,
> - Ahmed Omar
> http://nl.linkedin.com/in/adiaa
> Follow me on twitter
> @spawn_think
>


More information about the erlang-questions mailing list