Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Synchronet
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Main
Synchronet
Commits
3d68720d
Commit
3d68720d
authored
3 months ago
by
Rob Swindell
Browse files
Options
Downloads
Patches
Plain Diff
API change: long->int
No functional change
parent
1fb16776
No related branches found
No related tags found
No related merge requests found
Pipeline
#7965
passed
3 months ago
Stage: build
Stage: test
Stage: cleanup
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/xpdev/msg_queue.c
+10
-10
10 additions, 10 deletions
src/xpdev/msg_queue.c
src/xpdev/msg_queue.h
+10
-10
10 additions, 10 deletions
src/xpdev/msg_queue.h
with
20 additions
and
20 deletions
src/xpdev/msg_queue.c
+
10
−
10
View file @
3d68720d
...
@@ -26,7 +26,7 @@
...
@@ -26,7 +26,7 @@
#include
"threadwrap.h"
/* pthread_self */
#include
"threadwrap.h"
/* pthread_self */
#include
"msg_queue.h"
#include
"msg_queue.h"
msg_queue_t
*
msgQueueInit
(
msg_queue_t
*
q
,
long
flags
)
msg_queue_t
*
msgQueueInit
(
msg_queue_t
*
q
,
int
flags
)
{
{
if
(
q
==
NULL
)
{
if
(
q
==
NULL
)
{
if
((
q
=
(
msg_queue_t
*
)
malloc
(
sizeof
(
msg_queue_t
)))
==
NULL
)
if
((
q
=
(
msg_queue_t
*
)
malloc
(
sizeof
(
msg_queue_t
)))
==
NULL
)
...
@@ -69,7 +69,7 @@ bool msgQueueFree(msg_queue_t* q)
...
@@ -69,7 +69,7 @@ bool msgQueueFree(msg_queue_t* q)
return
true
;
return
true
;
}
}
long
msgQueueAttach
(
msg_queue_t
*
q
)
int
msgQueueAttach
(
msg_queue_t
*
q
)
{
{
if
(
q
==
NULL
)
if
(
q
==
NULL
)
return
-
1
;
return
-
1
;
...
@@ -79,7 +79,7 @@ long msgQueueAttach(msg_queue_t* q)
...
@@ -79,7 +79,7 @@ long msgQueueAttach(msg_queue_t* q)
return
q
->
refs
;
return
q
->
refs
;
}
}
long
msgQueueDetach
(
msg_queue_t
*
q
)
int
msgQueueDetach
(
msg_queue_t
*
q
)
{
{
int
refs
;
int
refs
;
...
@@ -136,12 +136,12 @@ static link_list_t* msgQueueWriteList(msg_queue_t* q)
...
@@ -136,12 +136,12 @@ static link_list_t* msgQueueWriteList(msg_queue_t* q)
return
&
q
->
in
;
return
&
q
->
in
;
}
}
long
msgQueueReadLevel
(
msg_queue_t
*
q
)
int
msgQueueReadLevel
(
msg_queue_t
*
q
)
{
{
return
listCountNodes
(
msgQueueReadList
(
q
));
return
listCountNodes
(
msgQueueReadList
(
q
));
}
}
static
bool
list_wait
(
link_list_t
*
list
,
long
timeout
)
static
bool
list_wait
(
link_list_t
*
list
,
int
timeout
)
{
{
#if defined(LINK_LIST_THREADSAFE)
#if defined(LINK_LIST_THREADSAFE)
if
(
timeout
<
0
)
/* infinite */
if
(
timeout
<
0
)
/* infinite */
...
@@ -152,7 +152,7 @@ static bool list_wait(link_list_t* list, long timeout)
...
@@ -152,7 +152,7 @@ static bool list_wait(link_list_t* list, long timeout)
return
listSemTryWaitBlock
(
list
,
timeout
);
return
listSemTryWaitBlock
(
list
,
timeout
);
#else
#else
clock_t
start
;
clock_t
start
;
long
count
;
int
count
;
start
=
msclock
();
start
=
msclock
();
while
((
count
=
listCountNodes
(
list
))
==
0
)
{
while
((
count
=
listCountNodes
(
list
))
==
0
)
{
...
@@ -166,7 +166,7 @@ static bool list_wait(link_list_t* list, long timeout)
...
@@ -166,7 +166,7 @@ static bool list_wait(link_list_t* list, long timeout)
#endif
#endif
}
}
bool
msgQueueWait
(
msg_queue_t
*
q
,
long
timeout
)
bool
msgQueueWait
(
msg_queue_t
*
q
,
int
timeout
)
{
{
bool
result
;
bool
result
;
link_list_t
*
list
=
msgQueueReadList
(
q
);
link_list_t
*
list
=
msgQueueReadList
(
q
);
...
@@ -180,7 +180,7 @@ bool msgQueueWait(msg_queue_t* q, long timeout)
...
@@ -180,7 +180,7 @@ bool msgQueueWait(msg_queue_t* q, long timeout)
return
result
;
return
result
;
}
}
void
*
msgQueueRead
(
msg_queue_t
*
q
,
long
timeout
)
void
*
msgQueueRead
(
msg_queue_t
*
q
,
int
timeout
)
{
{
link_list_t
*
list
=
msgQueueReadList
(
q
);
link_list_t
*
list
=
msgQueueReadList
(
q
);
...
@@ -189,7 +189,7 @@ void* msgQueueRead(msg_queue_t* q, long timeout)
...
@@ -189,7 +189,7 @@ void* msgQueueRead(msg_queue_t* q, long timeout)
return
listShiftNode
(
list
);
return
listShiftNode
(
list
);
}
}
void
*
msgQueuePeek
(
msg_queue_t
*
q
,
long
timeout
)
void
*
msgQueuePeek
(
msg_queue_t
*
q
,
int
timeout
)
{
{
link_list_t
*
list
=
msgQueueReadList
(
q
);
link_list_t
*
list
=
msgQueueReadList
(
q
);
...
@@ -222,7 +222,7 @@ list_node_t* msgQueueLastNode(msg_queue_t* q)
...
@@ -222,7 +222,7 @@ list_node_t* msgQueueLastNode(msg_queue_t* q)
return
listLastNode
(
msgQueueReadList
(
q
));
return
listLastNode
(
msgQueueReadList
(
q
));
}
}
long
msgQueueWriteLevel
(
msg_queue_t
*
q
)
int
msgQueueWriteLevel
(
msg_queue_t
*
q
)
{
{
return
listCountNodes
(
msgQueueWriteList
(
q
));
return
listCountNodes
(
msgQueueWriteList
(
q
));
}
}
...
...
This diff is collapsed.
Click to expand it.
src/xpdev/msg_queue.h
+
10
−
10
View file @
3d68720d
...
@@ -35,8 +35,8 @@ typedef struct {
...
@@ -35,8 +35,8 @@ typedef struct {
link_list_t
in
;
link_list_t
in
;
link_list_t
out
;
link_list_t
out
;
pthread_t
owner_thread_id
;
/* reads from in, writes to out */
pthread_t
owner_thread_id
;
/* reads from in, writes to out */
long
refs
;
int
refs
;
unsigned
long
flags
;
/* private use flags */
unsigned
int
flags
;
/* private use flags */
void
*
private_data
;
void
*
private_data
;
}
msg_queue_t
;
}
msg_queue_t
;
...
@@ -44,21 +44,21 @@ typedef struct {
...
@@ -44,21 +44,21 @@ typedef struct {
#define MSG_QUEUE_BIDIR (1 << 1)
/* Bi-directional message queue */
#define MSG_QUEUE_BIDIR (1 << 1)
/* Bi-directional message queue */
#define MSG_QUEUE_ORPHAN (1 << 2)
/* Owner has detached */
#define MSG_QUEUE_ORPHAN (1 << 2)
/* Owner has detached */
DLLEXPORT
msg_queue_t
*
msgQueueInit
(
msg_queue_t
*
,
long
flags
);
DLLEXPORT
msg_queue_t
*
msgQueueInit
(
msg_queue_t
*
,
int
flags
);
DLLEXPORT
bool
msgQueueFree
(
msg_queue_t
*
);
DLLEXPORT
bool
msgQueueFree
(
msg_queue_t
*
);
DLLEXPORT
long
msgQueueAttach
(
msg_queue_t
*
);
DLLEXPORT
int
msgQueueAttach
(
msg_queue_t
*
);
DLLEXPORT
long
msgQueueDetach
(
msg_queue_t
*
);
DLLEXPORT
int
msgQueueDetach
(
msg_queue_t
*
);
DLLEXPORT
bool
msgQueueOwner
(
msg_queue_t
*
);
DLLEXPORT
bool
msgQueueOwner
(
msg_queue_t
*
);
/* Get/Set queue private data */
/* Get/Set queue private data */
DLLEXPORT
void
*
msgQueueSetPrivateData
(
msg_queue_t
*
,
void
*
);
DLLEXPORT
void
*
msgQueueSetPrivateData
(
msg_queue_t
*
,
void
*
);
DLLEXPORT
void
*
msgQueueGetPrivateData
(
msg_queue_t
*
);
DLLEXPORT
void
*
msgQueueGetPrivateData
(
msg_queue_t
*
);
DLLEXPORT
bool
msgQueueWait
(
msg_queue_t
*
q
,
long
timeout
);
DLLEXPORT
bool
msgQueueWait
(
msg_queue_t
*
q
,
int
timeout
);
DLLEXPORT
long
msgQueueReadLevel
(
msg_queue_t
*
);
DLLEXPORT
int
msgQueueReadLevel
(
msg_queue_t
*
);
DLLEXPORT
void
*
msgQueueRead
(
msg_queue_t
*
,
long
timeout
);
DLLEXPORT
void
*
msgQueueRead
(
msg_queue_t
*
,
int
timeout
);
DLLEXPORT
void
*
msgQueuePeek
(
msg_queue_t
*
,
long
timeout
);
DLLEXPORT
void
*
msgQueuePeek
(
msg_queue_t
*
,
int
timeout
);
DLLEXPORT
void
*
msgQueueFind
(
msg_queue_t
*
,
const
void
*
,
size_t
length
);
DLLEXPORT
void
*
msgQueueFind
(
msg_queue_t
*
,
const
void
*
,
size_t
length
);
DLLEXPORT
list_node_t
*
msgQueueFirstNode
(
msg_queue_t
*
);
DLLEXPORT
list_node_t
*
msgQueueFirstNode
(
msg_queue_t
*
);
DLLEXPORT
list_node_t
*
msgQueueLastNode
(
msg_queue_t
*
);
DLLEXPORT
list_node_t
*
msgQueueLastNode
(
msg_queue_t
*
);
...
@@ -66,7 +66,7 @@ DLLEXPORT list_node_t* msgQueueLastNode(msg_queue_t*);
...
@@ -66,7 +66,7 @@ DLLEXPORT list_node_t* msgQueueLastNode(msg_queue_t*);
#define msgQueuePrevNode(node) listPrevNode(node)
#define msgQueuePrevNode(node) listPrevNode(node)
#define msgQueueNodeData(node) listNodeData(node)
#define msgQueueNodeData(node) listNodeData(node)
DLLEXPORT
long
msgQueueWriteLevel
(
msg_queue_t
*
);
DLLEXPORT
int
msgQueueWriteLevel
(
msg_queue_t
*
);
DLLEXPORT
bool
msgQueueWrite
(
msg_queue_t
*
,
const
void
*
,
size_t
length
);
DLLEXPORT
bool
msgQueueWrite
(
msg_queue_t
*
,
const
void
*
,
size_t
length
);
#if defined(__cplusplus)
#if defined(__cplusplus)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment