[Interest] Why use the sleep () function

Sze Howe Koh szehowe.koh at gmail.com
Wed May 21 14:29:05 CEST 2014


On 21 May 2014 20:13, erlin <evazquez at grm.uci.cu> wrote:
> This is a function that allows me to make a streaming video using
> libvlc_vlm_add_broadcast () and libvlc_vlm_play_media () Bookseller
> libvlc part of VLC. They use the function sleep () and I want to know
> why they use it.
> I searched many places, and meeting all the same, but none explains why
> I needed the sleep.
> I wonder if there is another alternative. I speak little English and
> have restricted Internet. Please respond is very important to me.
>>> void Streaming::ejecutar(QString sout,QString target)
>>> {
>>>
>>>       const char* params[] = {"screen-top=0",
>>>                                  "screen-left=0",
>>>                                  "screen-width=640",
>>>                                  "screen-height=480",
>>>                                  "screen-fps=30"};
>>>          libvlc_instance_t *inst = libvlc_new(0, NULL);
>>>          libvlc_vlm_add_broadcast(inst, "mybroad",
>>>                  target.toAscii(),
>>>                  sout.toAscii(),
>>>                  5, params, // <= 5 == sizeof(params) == count of parameters
>>>                  1, 0);
>>>          libvlc_vlm_play_media(inst, "mybroad");
>>>          sleep(10); //Here is the doubt
>>>          libvlc_vlm_stop_media(inst,"mybroad");
>>>          libvlc_vlm_release(inst);
>>>
>>> }

Hi,

If you want to know *why* they used sleep(), you should ask the people
who wrote the code. The Qt Project doesn't know the answer.

If you want to know *what* sleep() does, here is the answer: It
freezes the thread for a while, to let other threads work.


Regards,
Sze-Howe



More information about the Interest mailing list