summaryrefslogtreecommitdiff
path: root/src/utils.c
diff options
context:
space:
mode:
authoryctct <yctct@yctct.com>2026-09-13 18:58:14 +0200
committeryctct <yctct@yctct.com>2026-09-13 18:58:14 +0200
commit47beba686ff9d2aab63738fba7176a5235703d05 (patch)
treef839ed36a9e9d4476fcdc59379b17903abfa35c8 /src/utils.c
Add all files, first commit
Diffstat (limited to 'src/utils.c')
-rw-r--r--src/utils.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/utils.c b/src/utils.c
new file mode 100644
index 0000000..e409f7d
--- /dev/null
+++ b/src/utils.c
@@ -0,0 +1,20 @@
+#include "codexion.h"
+
+void swap(t_ticket a, t_ticket b)
+{
+ t_ticket temp;
+
+ temp = a;
+ a = b;
+ b = temp;
+}
+
+int get_id(t_philo *philo)
+{
+ int id;
+
+ (void)pthread_mutex_lock(&philo->mutex_id);
+ id = philo->id;
+ (void)pthread_mutex_unlock(&philo->mutex_id);
+ return (id);
+}