Applies to: ASN.1/C# v5.3

Codec and PDU objects are not safe to be shared across multiple threads that can simultaneously access the objects. However, the API can be used in a multithreaded environment. By not assuming any specific usage, the API allows the application to choose its performance and architectural preferences. This design provides the best performance (when used within single threads, multiple threads, or both, without sharing objects) and removes any risks of dead-locking, which might occur in case the API attempts internal synchronization on its own.

Note that the application is responsible for serializing access to codecs and/or data objects, for example, by using C# lock:

var codec = new BerCodec();

. . . 

// if used by multiple threads, lock it before using
lock (codec) 
	// use the codec safely
        codec.Encode(pdu, data); 

        . . . 

This documentation applies to the OSS® ASN.1 Tools for C# release 5.3 and later.

Copyright © 2024 OSS Nokalva, Inc. All rights reserved.
No part of this publication may be reproduced, stored in a retrieval system, or transmitted in any form or by any means electronic, mechanical, photocopying, recording or otherwise, without the prior permission of OSS Nokalva, Inc.
Every distributed copy of the OSS® ASN.1 Tools for C# is associated with a specific license and related unique license number. That license determines, among other things, what functions of the OSS ASN.1 Tools for C# are available to you.