Re: [Vala] problem using sleep



Arkadi Viner wrote:
I have a small question about this code:

If I add some code below your example would it be executed before
"Process.spawn_command_line_async" ? I mean, the program will go on and only
"Process.spawn_command_line_ async" is delayed  ?

Yes, I thought that was what you wanted.

If so, how can I delay the whole program ?

You can use Thread.usleep(microseconds) for that:

------------------------------------------------------------------
int time_min = 5;

Thread.usleep (time_min * 60 * 1000 * 1000);
try {
        Process.spawn_command_line_async ("gksudo '/etc/acpi/hibernate.sh'");
} catch (Error e) {
        stderr.printf ("%s\n", e.message);
}
------------------------------------------------------------------


Best regards,

Frederik



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]