# OpenSC API Reference

sc_lock
3
opensc

# sc_lock

Lock a card for exclusive use

## Synopsis

    #include <opensc.h>

    int sc_lock(struct sc_card *card);

## Description

This function locks the card against modification from other threads or processes. The function may be called several times; a counter will be increased, and the card will be unlocked only when this counter reaches zero.

## Return value

Returns 0 on success, or a negative value in case of error.