public void WaitForSlotEvent(bool dontBlock, out bool eventOccured, out ulong slotId)
{
if (this._disposed)
throw new ObjectDisposedException(this.GetType().FullName);
ulong flags = (dontBlock) ? CKF.CKF_DONT_BLOCK : 0;
ulong slotId_ = 0;
CKR rv = _p11.C_WaitForSlotEvent(flags, ref slotId_, IntPtr.Zero);
if (dontBlock)
{
if (rv == CKR.CKR_OK)
{
eventOccured = true;
slotId = slotId_;
}
else if (rv == CKR.CKR_NO_EVENT)
{
eventOccured = false;
slotId = slotId_;
}
else
{
throw new Pkcs11Exception("C_WaitForSlotEvent", rv);
}
}
else
{
if (rv == CKR.CKR_OK)
{
eventOccured = true;
slotId = slotId_;
}
else
{
throw new Pkcs11Exception("C_WaitForSlotEvent", rv);
}
}
}