All Downloads are FREE. Search and download functionalities are using the official Maven repository.

zmq.util.Errno Maven / Gradle / Ivy

There is a newer version: 0.6.0
Show newest version
package zmq.util;

// Emulates the errno mechanism present in C++, in a per-thread basis.
public final class Errno
{
    private static final ThreadLocal local = new ThreadLocal()
    {
        @Override
        protected Integer initialValue()
        {
            return 0; // by default
        }
    };

    public int get()
    {
        return local.get();
    }

    public void set(int errno)
    {
        local.set(errno);
    }

    public boolean is(int err)
    {
        return get() == err;
    }

    @Override
    public String toString()
    {
        return "Errno[" + get() + "]";
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy