source: soft/giet_vm/giet_libs/spin_lock.h @ 396

Last change on this file since 396 was 368, checked in by alain, 10 years ago

1) Introducing the SBT barrier (Sliced Binary Tree)

in the barrier.h library.

2) Introducing a new remote_malloc.h library.

  • Property svn:executable set to *
File size: 1.9 KB
Line 
1//////////////////////////////////////////////////////////////////////////////////
2// File     : spin_lock.h         
3// Date     : 01/04/2012
4// Author   : alain greiner
5// Copyright (c) UPMC-LIP6
6///////////////////////////////////////////////////////////////////////////////////
7// The spin_lock.c and spin_lock.h files are part of the GIET-VM nano-kernel.
8// This  library implements a user-level lock.
9// It is a simple binary lock, without waiting queue.
10// The lock_acquire() and lock_release() functions do not require a system call.
11// If the platform does not provide hardware cache coherence, the lock must be
12// declared in a non cacheable segment,
13//
14// When a lock is defined in the mapping, it has not to be declared in the
15// application code: it will be initialised in the boot phase,
16// and the vobj_get_vbase() system call (defined in stdio.c and stdio.h files)
17// can be used to get the virtual base address of the lock from it's name.
18///////////////////////////////////////////////////////////////////////////////////
19
20#ifndef _GIET_SPIN_LOCK_H_
21#define _GIET_SPIN_LOCK_H_
22
23///////////////////////////////////////////////////////////////////////////////////
24//  lock structure
25///////////////////////////////////////////////////////////////////////////////////
26
27typedef struct giet_lock_s
28{
29    char name[60];      // lock name
30    unsigned int value; // taken if value != 0
31} giet_lock_t;
32
33//////////////////////////////////////////////////////////////////////////////
34//  access functions
35//////////////////////////////////////////////////////////////////////////////
36
37extern void lock_acquire(giet_lock_t * lock);
38extern void lock_release(giet_lock_t * lock);
39
40#endif
41
42// Local Variables:
43// tab-width: 4
44// c-basic-offset: 4
45// c-file-offsets:((innamespace . 0)(inline-open . 0))
46// indent-tabs-mode: nil
47// End:
48// vim: filetype=c:expandtab:shiftwidth=4:tabstop=4:softtabstop=4
49
Note: See TracBrowser for help on using the repository browser.