~ubuntu-branches/debian/sid/kamailio/sid

« back to all changes in this revision

Viewing changes to modules/tm/lock.c

  • Committer: Package Import Robot
  • Author(s): Victor Seva
  • Date: 2014-01-06 11:47:13 UTC
  • mfrom: (1.1.5)
  • Revision ID: package-import@ubuntu.com-20140106114713-t8xidp4arzrnyeya
Tags: 4.1.1-1
* New upstream release
* debian/patches:
  - add upstream fixes
* Added tls outbound websocket autheph dnssec modules
  - openssl exception added to their license
* removing sparc and ia64 from supported archs
  for mono module (Closes: #728915)

Show diffs side-by-side

added added

removed removed

Lines of Context:
71
71
static int sem_nr;
72
72
gen_lock_set_t* entry_semaphore=0;
73
73
gen_lock_set_t* reply_semaphore=0;
 
74
gen_lock_set_t* async_semaphore=0;
74
75
#endif
75
76
 
76
77
 
100
101
                        lock_set_destroy(reply_semaphore);
101
102
                        lock_set_dealloc(reply_semaphore);
102
103
                }
 
104
                if (async_semaphore!=0){
 
105
                        lock_set_destroy(async_semaphore);
 
106
                        lock_set_dealloc(async_semaphore);
 
107
                }
103
108
                
104
109
                if (i==0){
105
110
                        LOG(L_CRIT, "lock_initialize: could not allocate semaphore"
154
159
                        i--;
155
160
                        goto again;
156
161
        }
 
162
        i++;
 
163
        if (((async_semaphore=lock_set_alloc(i))==0)||
 
164
                (lock_set_init(async_semaphore)==0)){
 
165
                        if (async_semaphore){
 
166
                                lock_set_dealloc(async_semaphore);
 
167
                                async_semaphore=0;
 
168
                        }
 
169
                        DBG("DEBUG:lock_initialize: async semaphore initialization"
 
170
                                " failure: %s\n", strerror(errno));
 
171
                        probe_run=1;
 
172
                        i--;
 
173
                        goto again;
 
174
        }
 
175
        
157
176
 
158
177
        /* return success */
159
178
        LOG(L_INFO, "INFO: semaphore arrays of size %d allocated\n", sem_nr );
193
212
                lock_set_destroy(reply_semaphore);
194
213
                lock_set_dealloc(reply_semaphore);
195
214
        };
196
 
        entry_semaphore =  reply_semaphore = 0;
 
215
        if (async_semaphore !=0) {
 
216
                lock_set_destroy(async_semaphore);
 
217
                lock_set_dealloc(async_semaphore);
 
218
        };
 
219
        entry_semaphore =  reply_semaphore = async_semaphore = 0;
197
220
 
198
221
}
199
222
#endif /*GEN_LOCK_T_PREFERED*/
229
252
        return 0;
230
253
}
231
254
 
232
 
 
 
255
int init_async_lock( struct cell *cell )
 
256
{
 
257
#ifdef GEN_LOCK_T_PREFERED
 
258
        lock_init(&cell->async_mutex);
 
259
#else
 
260
        cell->async_mutex.semaphore_set=async_semaphore;
 
261
        cell->async_mutex.semaphore_index = cell->hash_index % sem_nr;
 
262
#endif /* GEN_LOCK_T_PREFERED */
 
263
        return 0;
 
264
}
233
265
 
234
266
int release_cell_lock( struct cell *cell )
235
267
{