--- description: "Learn more about: C26130" title: C26130 ms.date: 11/04/2016 ms.topic: reference f1_keywords: ["C26130"] helpviewer_keywords: ["C26130"] ms.assetid: 535e2356-bc84-4549-983d-7d29aee2249c --- # C26130 > warning C26130: Missing annotation \_Requires\_lock\_held\_(\) or \_No\_competing\_thread\_ at function \. Otherwise it could be a race condition. Variable \ should be protected by lock \. Warning C26130 is issued when the analyzer detects a potential race condition but infers that the function is likely to be run in a single threaded mode, for example, when the function is in the initialization stage based on certain heuristics. ## Examples In the following example, warning C26130 is generated because a `_Guarded_by_` member is being modified without a lock. ```cpp typedef struct _DATA { CRITICAL_SECTION cs; _Guarded_by_(cs) int data; } DATA; void Init(DATA* p) { p->data = 0; // Warning C26130 } ``` If the previous code is guaranteed to be operated in a single threaded mode, annotate the function by using `_No_competing_thread_`, as shown in the following example. ```cpp typedef struct _DATA { CRITICAL_SECTION cs; _Guarded_by_(cs) int data; } DATA; _No_competing_thread_ void Init(DATA* p) { p->data = 0; // Warning C26130 will be resolved } ``` Alternatively, you can annotate a code fragment by using `_No_competing_thread_begin_` and `_No_competing_thread_end_`, as follows. ```cpp typedef struct _DATA { CRITICAL_SECTION cs; _Guarded_by_(cs) int data; } DATA; void Init(DATA* p) { _No_competing_thread_begin_ p->data = 0; // Warning C26130 will be resolved _No_competing_thread_end_ } ```