Lines Matching refs:instance

47   sys_mutex_lock(&call_data->threadsync_node->instance->sem_usage_mutex);
48 call_data->threadsync_node->instance->sync_fn(fn, call_data);
49 sys_sem_wait(&call_data->threadsync_node->instance->sem);
50 sys_mutex_unlock(&call_data->threadsync_node->instance->sem_usage_mutex);
64 sys_sem_signal(&call_data->threadsync_node->instance->sem);
68 threadsync_get_value(struct snmp_node_instance *instance, void *value)
70 struct threadsync_data *call_data = (struct threadsync_data *)instance->reference.ptr;
89 sys_sem_signal(&call_data->threadsync_node->instance->sem);
93 threadsync_set_test(struct snmp_node_instance *instance, u16_t len, void *value)
95 struct threadsync_data *call_data = (struct threadsync_data *)instance->reference.ptr;
115 sys_sem_signal(&call_data->threadsync_node->instance->sem);
119 threadsync_set_value(struct snmp_node_instance *instance, u16_t len, void *value)
121 struct threadsync_data *call_data = (struct threadsync_data *)instance->reference.ptr;
137 sys_sem_signal(&call_data->threadsync_node->instance->sem);
141 threadsync_release_instance(struct snmp_node_instance *instance)
143 struct threadsync_data *call_data = (struct threadsync_data *)instance->reference.ptr;
158 sys_sem_signal(&call_data->threadsync_node->instance->sem);
169 sys_sem_signal(&call_data->threadsync_node->instance->sem);
173 do_sync(const u32_t *root_oid, u8_t root_oid_len, struct snmp_node_instance *instance, snmp_threadsync_called_fn fn)
175 const struct snmp_threadsync_node *threadsync_node = (const struct snmp_threadsync_node *)(const void *)instance->node;
176 struct threadsync_data *call_data = &threadsync_node->instance->data;
185 instance->reference.ptr = call_data;
186 snmp_oid_assign(&call_data->proxy_instance.instance_oid, instance->instance_oid.id, instance->instance_oid.len);
196 instance->access = call_data->proxy_instance.access;
197 instance->asn1_type = call_data->proxy_instance.asn1_type;
198 instance->release_instance = threadsync_release_instance;
199 instance->get_value = (call_data->proxy_instance.get_value != NULL) ? threadsync_get_value : NULL;
200 instance->set_value = (call_data->proxy_instance.set_value != NULL) ? threadsync_set_value : NULL;
201 instance->set_test = (call_data->proxy_instance.set_test != NULL) ? threadsync_set_test : NULL;
202 snmp_oid_assign(&instance->instance_oid, call_data->proxy_instance.instance_oid.id, call_data->proxy_instance.instance_oid.len);
209 snmp_threadsync_get_instance(const u32_t *root_oid, u8_t root_oid_len, struct snmp_node_instance *instance)
211 return do_sync(root_oid, root_oid_len, instance, get_instance_synced);
215 snmp_threadsync_get_next_instance(const u32_t *root_oid, u8_t root_oid_len, struct snmp_node_instance *instance)
217 return do_sync(root_oid, root_oid_len, instance, get_next_instance_synced);
220 /** Initializes thread synchronization instance */
221 void snmp_threadsync_init(struct snmp_threadsync_instance *instance, snmp_threadsync_synchronizer_fn sync_fn)
223 err_t err = sys_mutex_new(&instance->sem_usage_mutex);
225 err = sys_sem_new(&instance->sem, 0);
228 instance->sync_fn = sync_fn;