---
name: "sc_wait_for_event"
section: "3"
platform: "linux"
package: "libopensc2-dev"
version: "0.11.13-1.1"
release: "Debian 6.0 (Squeeze)"
platforms: ["linux"]
url: "https://new.carta.tech/sc_wait_for_event"
---

# sc\_wait\_for\_event(3)

Wait for an event on a smart card reader

## NAME

sc\_wait\_for\_event - Wait for an event on a smart card reader

## SYNOPSIS

```
#include <opensc.h>
int sc_wait_for_event(sc_reader_t *readers[], int slots[], size_t numslots,
                      unsigned int event_mask,
                      int *reader, unsigned int *event, int timeout);
```

## DESCRIPTION

This function blocks until an event occurs on any of the readers/slots specified. The *readers* and *slots* fields list the readers and respective slots to be watched. *num\_slots* holds the total number of slots passed. The *event\_mask* parameter specifies the types of events to wait for. This may be a combination of the following flags:

SC\_EVENT\_CARD\_REMOVED

A card was removed from the reader/slot.

SC\_EVENT\_CARD\_INSERTED

A card was inserted into the reader/slot.

On returning, the *reader* parameter holds the reader which generated an event, and *event* holds the event flag, as in *event\_mask*.

The timeout parameter may be used to specify the maximum amount of time to wait for an event, in milliseconds. This may be set to -1 to wait forever.

## RETURN VALUE

Returns 0 if successful, 1 if a timeout occurred, or a negative value in case of error.
