Forbid copying classes in threading

This commit is contained in:
Dennis Felsing 2018-08-29 11:13:13 +02:00
parent 925f7b6325
commit c9f28ce094

View file

@ -67,6 +67,7 @@ class semaphore
public: public:
semaphore() { sphore_init(&sem); } semaphore() { sphore_init(&sem); }
~semaphore() { sphore_destroy(&sem); } ~semaphore() { sphore_destroy(&sem); }
semaphore(const semaphore&) = delete;
void wait() { sphore_wait(&sem); } void wait() { sphore_wait(&sem); }
void signal() { sphore_signal(&sem); } void signal() { sphore_signal(&sem); }
}; };
@ -86,6 +87,8 @@ public:
lock_destroy(var); lock_destroy(var);
} }
lock(const lock&) = delete;
void take() { lock_wait(var); } void take() { lock_wait(var); }
void release() { lock_unlock(var); } void release() { lock_unlock(var); }
}; };
@ -104,6 +107,8 @@ public:
{ {
var->release(); var->release();
} }
scope_lock(const scope_lock&) = delete;
}; };
#endif // BASE_TL_THREADING_H #endif // BASE_TL_THREADING_H