C++

std::jthread & stop tokens

Në shqip përdoret i njëjti emër.

ShpjegimiSQ

std::jthread (C++20) është si std::thread, por bën join vetë kur del nga blloku dhe mund të ndalet me request_stop() — më i sigurt dhe më i lehtë.

EnglishEN

std::jthread (C++20) is like std::thread, but joins automatically when it goes out of scope and can be stopped with request_stop() — safer and easier.

Si ta mendosh

Si një ndihmës që e lë punën vetë kur largohesh nga dhoma.

Lexoje në anglisht

Like a helper who stops work by themselves when you leave the room.

Shembull kodicpp

std::jthread t([](std::stop_token st) {
    while (!st.stop_requested()) { /* punë */ }
});

Terma të lidhur