By request: moved lightweight protection to macros.

This commit is contained in:
davidhaas
2003-02-12 22:00:18 +00:00
parent 4fc309b1dd
commit de29a0818e
3 changed files with 68 additions and 86 deletions

View File

@@ -110,8 +110,21 @@ void sys_mbox_fetch(sys_mbox_t mbox, void **msg);
In some implementations they can provide a more light-weight protection
mechanism than using semaphores. Otherwise semaphores can be used for
implementation */
#ifndef SYS_ARCH_PROTECT
#ifdef SYS_LIGHTWEIGHT_PROT
#define SYS_ARCH_DECL_PROTECT(lev) sys_prot_t lev
#define SYS_ARCH_PROTECT(lev) lev = sys_arch_protect()
#define SYS_ARCH_UNPROTECT(lev) sys_arch_unprotect(lev)
sys_prot_t sys_arch_protect(void);
void sys_arch_unprotect(sys_prot_t pval);
#else /* SYS_LIGHTWEIGHT_PROT */
#define SYS_ARCH_DECL_PROTECT(lev)
#define SYS_ARCH_PROTECT(lev)
#define SYS_ARCH_UNPROTECT(lev)
#endif /* SYS_LIGHTWEIGHT_PROT */
#endif /* SYS_ARCH_PROTECT */
/* Thread functions. */
sys_thread_t sys_thread_new(void (* thread)(void *arg), void *arg);