---
name: "ACE_sema_t"
section: "3"
platform: "linux"
package: "libace-doc"
version: "5.0.7-4"
release: "Debian 2.2 (Potato)"
platforms: ["linux"]
url: "https://new.carta.tech/ACE_sema_t"
---

# ACE\_sema\_t(3)

This is used to implement semaphores for platforms that support POSIX pthreads, but do \*not\* support POSIX semaphores, i.e., it's a different type than the POSIX sem\_t.

## NAME

ACE\_sema\_t -  This is used to implement semaphores for platforms that support POSIX pthreads, but do \*not\* support POSIX semaphores, i.e., it's a different type than the POSIX sem\_t.

## SYNOPSIS

```
#include <ace/OS.h>
class ACE_sema_t
{
  public:
    friend class ACE_OS;
    ACE_thread_mutex_t lock_;
    ACE_event_t count_nonzero_;
    u_int count_;
  protected:
    ACE_mutex_t lock_;
    ACE_cond_t count_nonzero_;
    u_long count_;
    u_long waiters_;
};
```

## PUBLIC MEMBERS

```
friend class ACE_OS;
```

```
ACE_thread_mutex_t lock_;
```

Serializes access to count\_.

```
ACE_event_t count_nonzero_;
```

This event is signaled whenever the count becomes non-zero.

```
u_int count_;
```

Current count of the semaphore.

## PROTECTED MEMBERS

```
ACE_mutex_t lock_;
```

Serialize access to internal state.

```
ACE_cond_t count_nonzero_;
```

Block until there are no waiters.

```
u_long count_;
```

Count of the semaphore.

```
u_long waiters_;
```

Number of threads that have called ACE\_OS::sema\_wait.

## AUTHOR

Doug Schmidt schmidt@cs.wustl.edu, Jesper S. M\|ller stophph@diku.dk, and a cast of thousands...

## The ACE\_Sched\_Priority type should be used for platform-

independent thread and process priorities, by convention. int should be used for OS-specific priorities.

## typedef for the \_stat data structure

## Giving unique ACE scoped names for some important

RTSignal-Related constants. Becuase sometimes, different platforms use different names for these constants.

## LIBRARY

ace
