# LockItem

Locks an item.

### Synopsis

`int32 LockItem( Item s, uint32 flags )`

### Description

This procedure locks an item.

Note: Currently, semaphores are the only items that can be locked. You can lock semaphores by calling `LockSemaphore()`.

### Arguments

s
  The number of the item to be locked.

flags
  Semaphore flags.

Only one flag is currently defined:

SEM_WAIT
  If the item to be locked is already locked, put the calling task into wait state until the item is available.

### Return Value

The procedure returns 1 if the item was successfully locked. If the item is already locked and the SEM_WAIT flag is not set (which indicates that the calling task does not want to wait until the item is available), the procedure returns 0. If an error occurs, the procedure returns an error code.

### Implementation

SWI implemented in kernel folio V20.

This is the same SWI as `LockSemaphore()`

### Associated Files

item.h
  ANSI C Prototype

### See Also

``DeleteItem`(), UnlockItem()`

#