MXS-2067: Remove spinlock.h

Removed the spinlock.h header and replaced with plain pthread types and
functions.
This commit is contained in:
Markus Mäkelä
2018-09-26 18:55:10 +03:00
parent c95adf1f2e
commit 9278da1f54
50 changed files with 392 additions and 472 deletions

View File

@ -376,7 +376,7 @@ static int maxscaled_accept(DCB* listener)
continue;
}
spinlock_init(&maxscaled_protocol->lock);
pthread_mutex_init(&maxscaled_protocol->lock, NULL);
client_dcb->protocol = (void*)maxscaled_protocol;
client_dcb->session = session_alloc(listener->session->service, client_dcb);
@ -407,13 +407,13 @@ static int maxscaled_close(DCB* dcb)
return 0;
}
spinlock_acquire(&maxscaled->lock);
pthread_mutex_lock(&maxscaled->lock);
if (maxscaled->username)
{
MXS_FREE(maxscaled->username);
maxscaled->username = NULL;
}
spinlock_release(&maxscaled->lock);
pthread_mutex_unlock(&maxscaled->lock);
return 0;
}

View File

@ -26,7 +26,6 @@
* @endverbatim
*/
#include <maxscale/dcb.h>
#include <maxscale/spinlock.h>
#include <maxscale/housekeeper.h>
MXS_BEGIN_DECLS
@ -36,9 +35,9 @@ MXS_BEGIN_DECLS
*/
typedef struct maxscaled
{
SPINLOCK lock; /**< Protocol structure lock */
int state; /**< The connection state */
char* username; /**< The login name of the user */
pthread_mutex_t lock; /**< Protocol structure lock */
int state; /**< The connection state */
char* username; /**< The login name of the user */
} MAXSCALED;
#define MAXSCALED_STATE_LOGIN 1 /**< Waiting for user */