PrismML představilo Ternary Bonsai 2.5 27B, kompaktní jazykový model zaměřený na programování a práci s nástroji. V podstatě se jedná o extrémně komprimovanou variantu open-weight modelu Qwen3.8 27B do ternární kvantizace (1,76 bitu na váhu), takže zabírá přibližně pouze 5,9 GB. Váhy jsou dostupné na Hugging face pod licencí Apache 2.0.
Na Slovensku vyvolala politický rozruch influencerka Lívie Pavlíková, která na svých sítích zveřejnila video ze hry Grand Theft Auto VI, v němž její postava střílí na duhovou vlajku. Poslanci Progresivného Slovenska na ni v reakci podali trestní oznámení s odvoláním se na hypotetické riziko eskalace nenávisti vůči sexuálním menšinám. Hnutí Republika ji naopak jmenovalo předsedkyní své nově vzniklé mládežnické organizace Mladá
… více »
template<typename T>
class CancelableThreadData
{
protected:
bool _is_cleanup;
T* _data;
static void _cleanup_func(void* d);
public:
template<typename... T_args>
CancelableThreadData(T_args... args);
~CancelableThreadData();
T* operator->() { return _data; }
const T* operator->() const { return _data; }
T& operator*() { return *_data; }
const T& operator*() const { return *_data; }
};
template<typename T>
void CancelableThreadData<T>::_cleanup_func(void* d)
{
((CancelableThreadData<T>*)(d))->_is_cleanup = true;
((CancelableThreadData<T>*)(d))->~CancelableThreadData();
}
template<typename T>
template<typename... T_args>
CancelableThreadData<T>::CancelableThreadData(T_args... args)
{
_is_cleanup = false;
_data = new T(args...);
pthread_cleanup_push(_cleanup_func, (void*)_data);
}
/* Line 272 */template<typename T>
CancelableThreadData<T>::~CancelableThreadData()
{
if (!_is_cleanup) pthread_cleanup_pop(0);
delete _data;
}
Výstup gcc:
Thread.h: In constructor ‘BurnLib::CancelableThreadData<T>::CancelableThreadData(T_args ...)’: Thread.h:272:10: error: expected ‘while’ before ‘<’ token Thread.h:272:10: error: expected ‘(’ before ‘<’ token Thread.h:272:10: error: expected primary-expression before ‘<’ token Thread.h:272:20: error: expected nested-name-specifier before ‘T’ Thread.h:272:20: error: expected ‘(’ before ‘T’ Thread.h:272:20: error: expected ‘)’ before ‘T’ Thread.h:272:20: error: expected ‘;’ before ‘T’ Thread.h:272:21: error: expected unqualified-id before ‘>’ token
Řešení dotazu:
Tak ten manual zahodte a poridte si lepsi:
These functions may be implemented as macros. The application shall ensure that they appear as statements, and in pairs within the same lexical scope (that is, the pthread_cleanup_push() macro may be thought to expand to a token list whose first token is '{' with pthread_cleanup_pop() expanding to a token list whose last token is the corresponding '}' ).
. Nakonec pak skončim u assembleru, kde budu alespoň vědět, co se stane
Unlike some other implementations of threads, C++ destructors for automatic objects are allowed to run in a well defined and consistent manner when a thread is terminated.
....
When a thread terminates, the following occurs: If the thread was ended using pthread_exit(), pthread_cancel() or return from the thread start routine, then cancellation cleanup handlers and data destructors are run.
The thread is terminated. At the time that the thread is terminated, both C++ destructors for automatic objects and AS/400 cancel handlers run.
) mi řeknou, že to můžou být makra ...
Tiskni
Sdílej: