Changeset d27b6be for libcfa/src/concurrency
- Timestamp:
- Mar 22, 2021, 4:07:21 PM (3 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 304de00
- Parents:
- d971c8d
- Location:
- libcfa/src/concurrency
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/concurrency/clib/cfathread.cfa
rd971c8d rd27b6be 245 245 int cfathread_mutex_init(cfathread_mutex_t *restrict mut, const cfathread_mutexattr_t *restrict) __attribute__((nonnull (1))) { *mut = new(); return 0; } 246 246 int cfathread_mutex_destroy(cfathread_mutex_t *mut) __attribute__((nonnull (1))) { delete( *mut ); return 0; } 247 int cfathread_mutex_lock (cfathread_mutex_t *mut) __attribute__((nonnull (1))) { lock ( (*mut)->impl ); return 0; } 248 int cfathread_mutex_trylock(cfathread_mutex_t *mut) __attribute__((nonnull (1))) { try_lock( (*mut)->impl ); return 0; } 249 int cfathread_mutex_unlock (cfathread_mutex_t *mut) __attribute__((nonnull (1))) { unlock ( (*mut)->impl ); return 0; } 247 int cfathread_mutex_lock (cfathread_mutex_t *mut) __attribute__((nonnull (1))) { lock( (*mut)->impl ); return 0; } 248 int cfathread_mutex_unlock (cfathread_mutex_t *mut) __attribute__((nonnull (1))) { unlock( (*mut)->impl ); return 0; } 249 int cfathread_mutex_trylock(cfathread_mutex_t *mut) __attribute__((nonnull (1))) { 250 bool ret = try_lock( (*mut)->impl ); 251 if( ret ) return 0; 252 else return EBUSY; 253 } 250 254 251 255 //-------------------- -
libcfa/src/concurrency/locks.hfa
rd971c8d rd27b6be 32 32 static inline void ^?{}( single_acquisition_lock & this ) {} 33 33 static inline void lock ( single_acquisition_lock & this ) { lock ( (blocking_lock &)this ); } 34 static inline void try_lock ( single_acquisition_lock & this ) {try_lock( (blocking_lock &)this ); }34 static inline bool try_lock ( single_acquisition_lock & this ) { return try_lock( (blocking_lock &)this ); } 35 35 static inline void unlock ( single_acquisition_lock & this ) { unlock ( (blocking_lock &)this ); } 36 36 static inline void on_wait ( single_acquisition_lock & this ) { on_wait ( (blocking_lock &)this ); } … … 47 47 static inline void ^?{}( owner_lock & this ) {} 48 48 static inline void lock ( owner_lock & this ) { lock ( (blocking_lock &)this ); } 49 static inline void try_lock ( owner_lock & this ) {try_lock( (blocking_lock &)this ); }49 static inline bool try_lock ( owner_lock & this ) { return try_lock( (blocking_lock &)this ); } 50 50 static inline void unlock ( owner_lock & this ) { unlock ( (blocking_lock &)this ); } 51 51 static inline void on_wait ( owner_lock & this ) { on_wait ( (blocking_lock &)this ); }
Note: See TracChangeset
for help on using the changeset viewer.